diff --git a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php index 6472b09..908fc25 100644 --- a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php @@ -315,13 +315,22 @@ public function testFieldapiField() { $result = $this->drupalGetJSON('test/serialize/node-field'); $this->assertEqual($result[0]['nid'], $node->id()); $this->assertEqual($result[0]['body'], $node->body->processed); + } - $node->body = ''; + /** + * Tests the field row style for XSS using fieldapi fields. + */ + public function testFieldapiFieldXSS() { + $this->drupalCreateContentType(array('type' => 'page')); + $node = $this->drupalCreateNode(); + $node_body = ''; + $node->body = array( + 'value' => $node_body, + 'format' => filter_default_format(), + ); $node->save(); $result = $this->drupalGetJSON('test/serialize/node-field'); $this->assertEqual($result[0]['nid'], $node->id()); - $this->assertTRUE(strpos($result[0]['body'], 'assertTrue(strpos($result[0]['body'], '<script') !== FALSE); + $this->assertTrue(strpos($this->getRawContent(), "