public function AcceptHeaderMatcherTest::testNoRouteFound in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/accept_header_routing_test/tests/Unit/AcceptHeaderMatcherTest.php \Drupal\Tests\accept_header_routing_teste\Unit\Routing\AcceptHeaderMatcherTest::testNoRouteFound()
Confirms that the AcceptHeaderMatcher throws an exception for no-route.
@expectedException \Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException @expectedExceptionMessage No route found for the specified formats application/json text/xml.
File
- core/
modules/ system/ tests/ modules/ accept_header_routing_test/ tests/ Unit/ AcceptHeaderMatcherTest.php, line 98 - Contains \Drupal\Tests\accept_header_routing_teste\Unit\Routing\AcceptHeaderMatcherTest.
Class
- AcceptHeaderMatcherTest
- Confirm that the mime types partial matcher is functioning properly.
Namespace
Drupal\Tests\accept_header_routing_teste\Unit\RoutingCode
public function testNoRouteFound() {
// Remove the sample routes that would match any method.
$routes = $this->fixtures
->sampleRouteCollection();
$routes
->remove('route_a');
$routes
->remove('route_b');
$routes
->remove('route_c');
$routes
->remove('route_d');
$request = Request::create('path/two', 'GET');
$request->headers
->set('Accept', 'application/json, text/xml;q=0.9');
$request
->setRequestFormat('json');
$this->matcher
->filter($routes, $request);
$this->matcher
->filter($routes, $request);
$this
->fail('No exception was thrown.');
}