AnnotationDirectoryLoaderTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\Tests\Component\Routing\Loader;
  11. use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
  12. use Symfony\Component\Routing\Route;
  13. use Symfony\Component\Routing\RouteCollection;
  14. use Symfony\Component\Config\Loader\LoaderResolver;
  15. use Symfony\Component\Config\FileLocator;
  16. class AnnotationDirectoryLoaderTest extends \PHPUnit_Framework_TestCase
  17. {
  18. /**
  19. * @covers Symfony\Component\Routing\Loader\AnnotationDirectoryLoader::supports
  20. */
  21. public function testSupports()
  22. {
  23. $annotationClassLoader = $this->getMockBuilder('Symfony\Component\Routing\Loader\AnnotationClassLoader')
  24. ->disableOriginalConstructor()
  25. ->getMockForAbstractClass();
  26. $loader = new AnnotationDirectoryLoader(new FileLocator(), $annotationClassLoader);
  27. $fixturesDir = __DIR__.'/../Fixtures';
  28. $this->assertTrue($loader->supports($fixturesDir), '->supports() returns true if the resource is loadable');
  29. $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
  30. $this->assertTrue($loader->supports($fixturesDir, 'annotation'), '->supports() checks the resource type if specified');
  31. $this->assertFalse($loader->supports($fixturesDir, 'foo'), '->supports() checks the resource type if specified');
  32. }
  33. }