]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
f0a8a0e32953994bc937a4107b98bb8d229f668c
[github/wallabag/wallabag.git] / vendor / symfony / routing / Symfony / Component / Routing / Tests / Loader / AnnotationFileLoaderTest.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\Routing\Tests\Loader;
13
14 use Symfony\Component\Routing\Loader\AnnotationFileLoader;
15 use Symfony\Component\Config\FileLocator;
16
17 class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest
18 {
19 protected $loader;
20 protected $reader;
21
22 protected function setUp()
23 {
24 parent::setUp();
25
26 $this->reader = $this->getReader();
27 $this->loader = new AnnotationFileLoader(new FileLocator(), $this->getClassLoader($this->reader));
28 }
29
30 public function testLoad()
31 {
32 $this->reader->expects($this->once())->method('getClassAnnotation');
33
34 $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php');
35 }
36
37 public function testSupports()
38 {
39 $fixture = __DIR__.'/../Fixtures/annotated.php';
40
41 $this->assertTrue($this->loader->supports($fixture), '->supports() returns true if the resource is loadable');
42 $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
43
44 $this->assertTrue($this->loader->supports($fixture, 'annotation'), '->supports() checks the resource type if specified');
45 $this->assertFalse($this->loader->supports($fixture, 'foo'), '->supports() checks the resource type if specified');
46 }
47 }