public function ContentTypeHeaderMatcherTest::testNoRouteFound in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php \Drupal\Tests\Core\Routing\ContentTypeHeaderMatcherTest::testNoRouteFound()
Confirms that the matcher throws an exception for no-route.
@expectedException \Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException @expectedExceptionMessage No route found that matches the Content-Type header.
File
- core/
tests/ Drupal/ Tests/ Core/ Routing/ ContentTypeHeaderMatcherTest.php, line 99 - Contains \Drupal\Tests\Core\Routing\ContentTypeHeaderMatcherTest.
Class
- ContentTypeHeaderMatcherTest
- Confirm that the content types partial matcher is functioning properly.
Namespace
Drupal\Tests\Core\RoutingCode
public function testNoRouteFound() {
$matcher = new ContentTypeHeaderMatcher();
$routes = $this->fixtures
->contentRouteCollection();
$request = Request::create('path/two', 'POST');
$request->headers
->set('Content-type', 'application/hal+json');
$matcher
->filter($routes, $request);
$this
->fail('No exception was thrown.');
}