-
-
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.
#7531: [HttpKernel][Config] FileLocator adds NULL as global resource …
…path
- Loading branch information
Showing
2 changed files
with
67 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
61 changes: 61 additions & 0 deletions
61
src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.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,61 @@ | ||
<?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\Config; | ||
|
||
use Symfony\Component\HttpKernel\Config\FileLocator; | ||
use Symfony\Component\HttpKernel\KernelInterface; | ||
|
||
class FileLocatorTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
/** @var KernelInterface */ | ||
private $kernel; | ||
|
||
public function setUp() | ||
{ | ||
$this->kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface'); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
$this->kernel = null; | ||
} | ||
|
||
public function testLocate() | ||
{ | ||
$this->kernel | ||
->expects($this->atLeastOnce()) | ||
->method('locateResource') | ||
->with('@BundleName/some/path', null, true) | ||
->will($this->returnValue('/bundle-name/some/path')); | ||
$locator = new FileLocator($this->kernel); | ||
$this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path')); | ||
|
||
$this->kernel | ||
->expects($this->never()) | ||
->method('locateResource'); | ||
$this->setExpectedException('LogicException'); | ||
$locator->locate('/some/path'); | ||
} | ||
|
||
public function testLocateWithGlobalResourcePath() | ||
{ | ||
$this->kernel | ||
->expects($this->atLeastOnce()) | ||
->method('locateResource') | ||
->with('@BundleName/some/path', '/global/resource/path', false); | ||
|
||
$locator = new FileLocator($this->kernel, '/global/resource/path'); | ||
$locator->locate('@BundleName/some/path', null, false); | ||
} | ||
|
||
} |