1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Symfony\Tests\Component\Routing\Loader;
- use Symfony\Component\Routing\Loader\AnnotationClassLoader;
- require_once __DIR__.'/../Fixtures/AnnotatedClasses/AbstractClass.php';
- require_once __DIR__.'/AbstractAnnotationLoaderTest.php';
- class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
- {
- protected $loader;
- public function setUp()
- {
- parent::setUp();
- $this->loader = $this->getClassLoader($this->getReader());
- }
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testLoadMissingClass()
- {
- $this->loader->load('MissingClass');
- }
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testLoadAbstractClass()
- {
- $this->loader->load('Symfony\Tests\Component\Routing\Fixtures\AnnotatedClasses\AbstractClass');
- }
- /**
- * @covers Symfony\Component\Routing\Loader\AnnotationClassLoader::supports
- * @dataProvider provideTestSupportsChecksResource
- */
- public function testSupportsChecksResource($resource, $expectedSupports)
- {
- $this->assertSame($expectedSupports, $this->loader->supports($resource), '->supports() returns true if the resource is loadable');
- }
- public function provideTestSupportsChecksResource()
- {
- return array(
- array('class', true),
- array('\fully\qualified\class\name', true),
- array('namespaced\class\without\leading\slash', true),
- array('ÿClassWithLegalSpecialCharacters', true),
- array('5', false),
- array('foo.foo', false),
- array(null, false),
- );
- }
- /**
- * @covers Symfony\Component\Routing\Loader\AnnotationClassLoader::supports
- */
- public function testSupportsChecksTypeIfSpecified()
- {
- $this->assertTrue($this->loader->supports('class', 'annotation'), '->supports() checks the resource type if specified');
- $this->assertFalse($this->loader->supports('class', 'foo'), '->supports() checks the resource type if specified');
- }
- }
|