No Description

AnnotationDirectoryLoaderTest.php 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Routing\Tests\Loader;
  11. use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
  12. use Symfony\Component\Config\FileLocator;
  13. class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
  14. {
  15. protected $loader;
  16. protected $reader;
  17. protected function setUp()
  18. {
  19. parent::setUp();
  20. $this->reader = $this->getReader();
  21. $this->loader = new AnnotationDirectoryLoader(new FileLocator(), $this->getClassLoader($this->reader));
  22. }
  23. public function testLoad()
  24. {
  25. $this->reader->expects($this->exactly(2))->method('getClassAnnotation');
  26. $this->reader
  27. ->expects($this->any())
  28. ->method('getMethodAnnotations')
  29. ->will($this->returnValue(array()))
  30. ;
  31. $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
  32. }
  33. public function testSupports()
  34. {
  35. $fixturesDir = __DIR__.'/../Fixtures';
  36. $this->assertTrue($this->loader->supports($fixturesDir), '->supports() returns true if the resource is loadable');
  37. $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
  38. $this->assertTrue($this->loader->supports($fixturesDir, 'annotation'), '->supports() checks the resource type if specified');
  39. $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports() checks the resource type if specified');
  40. }
  41. }