diff --git a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php index 33a08e4..d25c705 100644 --- a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php @@ -136,6 +136,26 @@ public function testSerializerResponses() { $expected = $serializer->serialize($entities, 'xml'); $actual_xml = $this->drupalGet('test/serialize/entity'); $this->assertIdentical($actual_xml, $expected, 'The expected XML output was found.'); + + // Allow multiple formats. + $view->setDisplay('rest_export_1'); + $view->getDisplay()->setOption('style', array( + 'type' => 'serializer', + 'options' => array( + 'uses_fields' => FALSE, + 'formats' => array( + 'xml' => 'xml', + 'json' => 'json', + ), + ), + )); + $view->save(); + $expected = $serializer->serialize($entities, 'json'); + $actual_json = $this->drupalGet('test/serialize/entity', array(), array('Accept: application/json')); + $this->assertIdentical($actual_json, $expected, 'The expected JSON output was found.'); + $expected = $serializer->serialize($entities, 'xml'); + $actual_xml = $this->drupalGet('test/serialize/entity', array(), array('Accept: application/xml')); + $this->assertIdentical($actual_xml, $expected, 'The expected XML output was found.'); } /**