forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FrameworkBundle] Add unit tests for the CacheTemplateLocator class
- Loading branch information
Showing
2 changed files
with
55 additions
and
4 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
41 changes: 41 additions & 0 deletions
41
src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/CachedTemplateLocatorTest.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,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Loader; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Templating\Loader\CachedTemplateLocator; | ||
use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator; | ||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; | ||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase; | ||
|
||
class CachedTemplateLocatorTest extends TestCase | ||
{ | ||
public function testLocateACachedTemplate() | ||
{ | ||
$template = new TemplateReference('bundle', 'controller', 'name', 'format', 'engine'); | ||
|
||
$locator = $this | ||
->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\Loader\CachedTemplateLocator') | ||
->setMethods(array('getCachedTemplatePath')) | ||
->disableOriginalConstructor() | ||
->getMock() | ||
; | ||
|
||
$locator | ||
->expects($this->once()) | ||
->method('getCachedTemplatePath') | ||
->with($template->getSignature()) | ||
->will($this->returnValue('/cached/path/to/template')) | ||
; | ||
|
||
$this->assertEquals('/cached/path/to/template', $locator->locate($template)); | ||
} | ||
} |