]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
twig implementation
[github/wallabag/wallabag.git] / vendor / symfony / routing / Symfony / Component / Routing / Tests / Loader / AnnotationDirectoryLoaderTest.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\AnnotationDirectoryLoader;
15 use Symfony\Component\Config\FileLocator;
16
17 class AnnotationDirectoryLoaderTest 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 AnnotationDirectoryLoader(new FileLocator(), $this->getClassLoader($this->reader));
28 }
29
30 public function testLoad()
31 {
32 $this->reader->expects($this->exactly(2))->method('getClassAnnotation');
33
34 $this->reader
35 ->expects($this->any())
36 ->method('getMethodAnnotations')
37 ->will($this->returnValue(array()))
38 ;
39
40 $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
41 }
42
43 public function testSupports()
44 {
45 $fixturesDir = __DIR__.'/../Fixtures';
46
47 $this->assertTrue($this->loader->supports($fixturesDir), '->supports() returns true if the resource is loadable');
48 $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
49
50 $this->assertTrue($this->loader->supports($fixturesDir, 'annotation'), '->supports() checks the resource type if specified');
51 $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports() checks the resource type if specified');
52 }
53 }