FileLocatorTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Tests\Config;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\HttpKernel\Config\FileLocator;
  13. use Symfony\Component\HttpKernel\KernelInterface;
  14. class FileLocatorTest extends TestCase
  15. {
  16. public function testLocate()
  17. {
  18. $kernel = $this->createMock(KernelInterface::class);
  19. $kernel
  20. ->expects($this->atLeastOnce())
  21. ->method('locateResource')
  22. ->with('@BundleName/some/path')
  23. ->willReturn('/bundle-name/some/path');
  24. $locator = new FileLocator($kernel);
  25. $this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path'));
  26. $kernel
  27. ->expects($this->never())
  28. ->method('locateResource');
  29. $this->expectException(\LogicException::class);
  30. $locator->locate('/some/path');
  31. }
  32. }