4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Tests\Config;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\Config\FileLocator;
17 class FileLocatorTest extends TestCase
19 public function testLocate()
21 $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
23 ->expects($this->atLeastOnce())
24 ->method('locateResource')
25 ->with('@BundleName/some/path', null, true)
26 ->will($this->returnValue('/bundle-name/some/path'));
27 $locator = new FileLocator($kernel);
28 $this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path'));
31 ->expects($this->never())
32 ->method('locateResource');
33 $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
34 $locator->locate('/some/path');
37 public function testLocateWithGlobalResourcePath()
39 $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
41 ->expects($this->atLeastOnce())
42 ->method('locateResource')
43 ->with('@BundleName/some/path', '/global/resource/path', false);
45 $locator = new FileLocator($kernel, '/global/resource/path');
46 $locator->locate('@BundleName/some/path', null, false);