Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Routing / ContentTypeHeaderMatcherTest.php
index e2c73bbe95debf6f35e855bbde0d4ce142a12c51..87e3f3e6c94c5c7a9082d08cd82367dfdefdd669 100644 (file)
@@ -42,17 +42,28 @@ class ContentTypeHeaderMatcherTest extends UnitTestCase {
   }
 
   /**
-   * Tests that routes are not filtered on GET requests.
+   * Tests that routes are not filtered on safe requests.
+   *
+   * @dataProvider providerTestSafeRequestFilter
    */
-  public function testGetRequestFilter() {
+  public function testSafeRequestFilter($method) {
     $collection = $this->fixtures->sampleRouteCollection();
     $collection->addCollection($this->fixtures->contentRouteCollection());
 
-    $request = Request::create('path/two', 'GET');
+    $request = Request::create('path/two', $method);
     $routes = $this->matcher->filter($collection, $request);
     $this->assertEquals(count($routes), 7, 'The correct number of routes was found.');
   }
 
+  public function providerTestSafeRequestFilter() {
+    return [
+      ['GET'],
+      ['HEAD'],
+      ['OPTIONS'],
+      ['TRACE'],
+    ];
+  }
+
   /**
    * Tests that XML-restricted routes get filtered out on JSON requests.
    */