Commit
…nit tests
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,10 @@ public function load($class, $type = null) | |
); | ||
|
||
$class = new \ReflectionClass($class); | ||
if ($class->isAbstract()) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
schmittjoh
Contributor
|
||
throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class)); | ||
} | ||
|
||
if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { | ||
if (null !== $annot->getPattern()) { | ||
$globals['pattern'] = $annot->getPattern(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Tests\Component\Routing\Fixtures\AnnotatedClasses; | ||
|
||
abstract class AbstractClass | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Symfony\Tests\Component\Routing\Fixtures\AnnotatedClasses; | ||
|
||
class FooClass | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?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\Config\Loader\LoaderResolver; | ||
use Symfony\Component\Routing\Loader\AnnotationFileLoader; | ||
use Symfony\Component\Routing\Route; | ||
use Symfony\Component\Routing\RouteCollection; | ||
|
||
abstract class AbstractAnnotationLoaderTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function getReader() | ||
{ | ||
return $this->getMockBuilder('Doctrine\Common\Annotations\Reader') | ||
->disableOriginalConstructor() | ||
->getMock() | ||
; | ||
} | ||
|
||
public function getClassLoader($reader) | ||
{ | ||
return $this->getMockBuilder('Symfony\Component\Routing\Loader\AnnotationClassLoader') | ||
->setConstructorArgs(array($reader)) | ||
->getMockForAbstractClass() | ||
; | ||
} | ||
} |
This actually breaks some code, why was this necessary?