Skip to content

Commit

Permalink
[HttpKernel] tweaked previous merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 7, 2013
1 parent 171aa1d commit 12b7073
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/Config/FileLocator.php 100755 → 100644
Expand Up @@ -34,7 +34,7 @@ class FileLocator extends BaseFileLocator
public function __construct(KernelInterface $kernel, $path = null, array $paths = array())
{
$this->kernel = $kernel;
if(null !== $path) {
if (null !== $path) {
$this->path = $path;
$paths[] = $path;
}
Expand Down
28 changes: 7 additions & 21 deletions src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
Expand Up @@ -12,35 +12,21 @@
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
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
$kernel
->expects($this->atLeastOnce())
->method('locateResource')
->with('@BundleName/some/path', null, true)
->will($this->returnValue('/bundle-name/some/path'));
$locator = new FileLocator($this->kernel);
$locator = new FileLocator($kernel);
$this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path'));

$this->kernel
$kernel
->expects($this->never())
->method('locateResource');
$this->setExpectedException('LogicException');
Expand All @@ -49,13 +35,13 @@ public function testLocate()

public function testLocateWithGlobalResourcePath()
{
$this->kernel
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
$kernel
->expects($this->atLeastOnce())
->method('locateResource')
->with('@BundleName/some/path', '/global/resource/path', false);

$locator = new FileLocator($this->kernel, '/global/resource/path');
$locator = new FileLocator($kernel, '/global/resource/path');
$locator->locate('@BundleName/some/path', null, false);
}

}

0 comments on commit 12b7073

Please sign in to comment.