diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 4257a09b0e..c94fa31abd 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -89,6 +89,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ @mkdir($PHPUNIT_DIR, 0777, true); chdir($PHPUNIT_DIR); + if (file_exists("phpunit-$PHPUNIT_VERSION")) { + passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION")); + } passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\""); chdir("phpunit-$PHPUNIT_VERSION"); if ($SYMFONY_PHPUNIT_REMOVE) { diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 958217fcbe..5558ff87fd 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -120,12 +120,9 @@ abstract class AnnotationClassLoader implements LoaderInterface } if (0 === $collection->count() && $class->hasMethod('__invoke')) { + $globals = $this->resetGlobals(); foreach ($this->reader->getClassAnnotations($class) as $annot) { if ($annot instanceof $this->routeAnnotationClass) { - $globals['path'] = ''; - $globals['name'] = ''; - $globals['localized_paths'] = array(); - $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); } } @@ -254,18 +251,7 @@ abstract class AnnotationClassLoader implements LoaderInterface protected function getGlobals(\ReflectionClass $class) { - $globals = array( - 'path' => null, - 'localized_paths' => array(), - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), - 'host' => '', - 'condition' => '', - 'name' => '', - ); + $globals = $this->resetGlobals(); if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { if (null !== $annot->getName()) { @@ -310,6 +296,22 @@ abstract class AnnotationClassLoader implements LoaderInterface return $globals; } + private function resetGlobals() + { + return array( + 'path' => null, + 'localized_paths' => array(), + 'requirements' => array(), + 'options' => array(), + 'defaults' => array(), + 'schemes' => array(), + 'methods' => array(), + 'host' => '', + 'condition' => '', + 'name' => '', + ); + } + protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) { return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/InvokableController.php b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/InvokableController.php index b25a0ad92a..c70793a81d 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/InvokableController.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AnnotationFixtures/InvokableController.php @@ -5,7 +5,7 @@ namespace Symfony\Component\Routing\Tests\Fixtures\AnnotationFixtures; use Symfony\Component\Routing\Annotation\Route; /** - * @Route("/here", name="lol") + * @Route("/here", name="lol", methods={"GET", "POST"}, schemes={"https"}) */ class InvokableController { diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php index dd9af9db23..ec622c0261 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -92,6 +92,8 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest $routes = $this->loader->load(InvokableController::class); $this->assertCount(1, $routes); $this->assertEquals('/here', $routes->get('lol')->getPath()); + $this->assertEquals(array('GET', 'POST'), $routes->get('lol')->getMethods()); + $this->assertEquals(array('https'), $routes->get('lol')->getSchemes()); } public function testInvokableLocalizedControllerLoading() @@ -134,7 +136,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest $this->assertEquals('/the/path', $routes->get('post')->getPath()); } - public function testLocalizedMethodActionControllers() + public function testInvokableClassRouteLoadWithMethodAnnotation() { $routes = $this->loader->load(LocalizedMethodActionControllers::class); $this->assertCount(4, $routes); diff --git a/src/Symfony/Component/Workflow/EventListener/GuardListener.php b/src/Symfony/Component/Workflow/EventListener/GuardListener.php index 4f1c229e51..b95d91ae4a 100644 --- a/src/Symfony/Component/Workflow/EventListener/GuardListener.php +++ b/src/Symfony/Component/Workflow/EventListener/GuardListener.php @@ -28,17 +28,17 @@ class GuardListener private $configuration; private $expressionLanguage; private $tokenStorage; - private $authenticationChecker; + private $authorizationChecker; private $trustResolver; private $roleHierarchy; private $validator; - public function __construct(array $configuration, ExpressionLanguage $expressionLanguage, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authenticationChecker, AuthenticationTrustResolverInterface $trustResolver, RoleHierarchyInterface $roleHierarchy = null, ValidatorInterface $validator = null) + public function __construct(array $configuration, ExpressionLanguage $expressionLanguage, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, AuthenticationTrustResolverInterface $trustResolver, RoleHierarchyInterface $roleHierarchy = null, ValidatorInterface $validator = null) { $this->configuration = $configuration; $this->expressionLanguage = $expressionLanguage; $this->tokenStorage = $tokenStorage; - $this->authenticationChecker = $authenticationChecker; + $this->authorizationChecker = $authorizationChecker; $this->trustResolver = $trustResolver; $this->roleHierarchy = $roleHierarchy; $this->validator = $validator; @@ -94,7 +94,7 @@ class GuardListener return $role->getRole(); }, $roles), // needed for the is_granted expression function - 'auth_checker' => $this->authenticationChecker, + 'auth_checker' => $this->authorizationChecker, // needed for the is_* expression function 'trust_resolver' => $this->trustResolver, // needed for the is_valid expression function