<?php
namespace Symfony\Component\Routing\Tests\Loader;
use Symfony\Component\Routing\Loader\AnnotationClassLoader;
class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest {
protected $loader;
protected function setUp() {
parent::setUp();
$this->loader = $this
->getClassLoader($this
->getReader());
}
public function testLoadMissingClass() {
$this->loader
->load('MissingClass');
}
public function testLoadAbstractClass() {
$this->loader
->load('Symfony\\Component\\Routing\\Tests\\Fixtures\\AnnotatedClasses\\AbstractClass');
}
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,
),
);
}
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');
}
}