AnnotationFileLoaderTest.php 1.5 KB

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