Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / http-kernel / Tests / Config / FileLocatorTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\Tests\Config;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\Config\FileLocator;
16
17 class FileLocatorTest extends TestCase
18 {
19     public function testLocate()
20     {
21         $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
22         $kernel
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'));
29
30         $kernel
31             ->expects($this->never())
32             ->method('locateResource');
33         $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException');
34         $locator->locate('/some/path');
35     }
36
37     public function testLocateWithGlobalResourcePath()
38     {
39         $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
40         $kernel
41             ->expects($this->atLeastOnce())
42             ->method('locateResource')
43             ->with('@BundleName/some/path', '/global/resource/path', false);
44
45         $locator = new FileLocator($kernel, '/global/resource/path');
46         $locator->locate('@BundleName/some/path', null, false);
47     }
48 }