$this->routes =
new RouteCollection();
$this->routes->
add('test_1',
new Route('/test/1'
));
$this->routes->
add('view.test_view.page_1',
new Route('/test/2'
));
$view->
addDisplay('page', NULL, 'page_1'
);
} /**
* Tests if adding a requirement to a route only modify one route.
*/
public function testRoutesRequirements() { $this->restExport->
collectRoutes($this->routes
);
$requirements_1 =
$this->routes->
get('test_1'
)->
getRequirements();
$requirements_2 =
$this->routes->
get('view.test_view.page_1'
)->
getRequirements();
$this->
assertCount(0,
$requirements_1, 'First route has no requirement.'
);
$this->
assertCount(1,
$requirements_2, 'Views route with rest export had the format requirement added.'
);
// Check auth options.
$auth =
$this->routes->
get('view.test_view.page_1'
)->
getOption('_auth'
);
$this->
assertCount(1,
$auth, 'View route with rest export has an auth option added'
);
$this->
assertEquals('basic_auth',
$auth[0
], 'View route with rest export has the correct auth option added'
);
}