getMock('Symfony\Component\Routing\RouteCollection', NULL); $route_collection->add('test', $route); $event = new RouteBuildEvent($route_collection, 'test'); $subscriber = new SpecialAttributesRouteSubscriber(); $this->assertNull($subscriber->onAlterRoutes($event)); } /** * Tests the onAlterRoutes method for invalid variables. * * @param \Symfony\Component\Routing\Route $route * The route to check. * * @dataProvider providerTestOnRouteBuildingInvalidVariables * @covers ::onAlterRoutes */ public function testOnRouteBuildingInvalidVariables(Route $route) { $route_collection = $this->getMock('Symfony\Component\Routing\RouteCollection', NULL); $route_collection->add('test', $route); $event = new RouteBuildEvent($route_collection, 'test'); $subscriber = new SpecialAttributesRouteSubscriber(); $this->setExpectedException(\PHPUnit_Framework_Error_Warning::class, 'uses reserved variable names'); $subscriber->onAlterRoutes($event); } }