-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3.1: [VarDumper] Various minor fixes & cleanups Revert "bug #18935 [Form] Consider a violation even if the form is not submitted (egeloen)" [Config] Fix DirectoryResourceTest for symlinks [HttpKernel] Add missing SsiFragmentRendererTest [DoctrineBridge] Fix exception message and tests after misresolved merge Fixes the calendar in constructor to handle null
- Loading branch information
Showing
13 changed files
with
167 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\HttpKernel\Tests\Fragment; | ||
|
||
use Symfony\Component\HttpKernel\Controller\ControllerReference; | ||
use Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer; | ||
use Symfony\Component\HttpKernel\HttpCache\Ssi; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\UriSigner; | ||
|
||
class SsiFragmentRendererTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testRenderFallbackToInlineStrategyIfSsiNotSupported() | ||
{ | ||
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy(true)); | ||
$strategy->render('/', Request::create('/')); | ||
} | ||
|
||
public function testRender() | ||
{ | ||
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); | ||
|
||
$request = Request::create('/'); | ||
$request->setLocale('fr'); | ||
$request->headers->set('Surrogate-Capability', 'SSI/1.0'); | ||
|
||
$this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request)->getContent()); | ||
$this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent(), 'Strategy options should not impact the ssi include tag'); | ||
} | ||
|
||
public function testRenderControllerReference() | ||
{ | ||
$signer = new UriSigner('foo'); | ||
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy(), $signer); | ||
|
||
$request = Request::create('/'); | ||
$request->setLocale('fr'); | ||
$request->headers->set('Surrogate-Capability', 'SSI/1.0'); | ||
|
||
$reference = new ControllerReference('main_controller', array(), array()); | ||
$altReference = new ControllerReference('alt_controller', array(), array()); | ||
|
||
$this->assertEquals( | ||
'<!--#include virtual="/_fragment?_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller&_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D" -->', | ||
$strategy->render($reference, $request, array('alt' => $altReference))->getContent() | ||
); | ||
} | ||
|
||
/** | ||
* @expectedException \LogicException | ||
*/ | ||
public function testRenderControllerReferenceWithoutSignerThrowsException() | ||
{ | ||
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); | ||
|
||
$request = Request::create('/'); | ||
$request->setLocale('fr'); | ||
$request->headers->set('Surrogate-Capability', 'SSI/1.0'); | ||
|
||
$strategy->render(new ControllerReference('main_controller'), $request); | ||
} | ||
|
||
/** | ||
* @expectedException \LogicException | ||
*/ | ||
public function testRenderAltControllerReferenceWithoutSignerThrowsException() | ||
{ | ||
$strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); | ||
|
||
$request = Request::create('/'); | ||
$request->setLocale('fr'); | ||
$request->headers->set('Surrogate-Capability', 'SSI/1.0'); | ||
|
||
$strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); | ||
} | ||
|
||
private function getInlineStrategy($called = false) | ||
{ | ||
$inline = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer')->disableOriginalConstructor()->getMock(); | ||
|
||
if ($called) { | ||
$inline->expects($this->once())->method('render'); | ||
} | ||
|
||
return $inline; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters