From 85c2b9b15fa9a72ef00bac04d97fd7436dbeb673 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Fri, 12 Jan 2018 12:07:43 -0800 Subject: [PATCH] add failing test for `p-content` containing an `u-photo` --- tests/SanitizeTest.php | 12 ++++++++++++ tests/data/sanitize.example/photo-in-text-content | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/data/sanitize.example/photo-in-text-content diff --git a/tests/SanitizeTest.php b/tests/SanitizeTest.php index 56851a7..62e499a 100644 --- a/tests/SanitizeTest.php +++ b/tests/SanitizeTest.php @@ -167,6 +167,18 @@ class SanitizeTest extends PHPUnit_Framework_TestCase { $this->assertEquals('This is a photo post with an img tag inside the content.', $data->data->content->html); } + public function testPhotoInTextContentNoAlt() { + // https://github.com/aaronpk/XRay/issues/56 + + $url = 'http://sanitize.example/photo-in-text-content'; + $response = $this->parse(['url' => $url]); + + $body = $response->getContent(); + $this->assertEquals(200, $response->getStatusCode()); + $data = json_decode($body); + + echo json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); + $this->assertObjectNotHasAttribute('name', $data->data); $this->assertEquals('http://target.example.com/photo.jpg', $data->data->photo[0]); $this->assertEquals('This is a photo post with an img tag inside the content.', $data->data->content->text); diff --git a/tests/data/sanitize.example/photo-in-text-content b/tests/data/sanitize.example/photo-in-text-content new file mode 100644 index 0000000..36dd2b2 --- /dev/null +++ b/tests/data/sanitize.example/photo-in-text-content @@ -0,0 +1,14 @@ +HTTP/1.1 200 OK +Server: Apache +Date: Wed, 09 Dec 2015 03:29:14 GMT +Content-Type: text/html; charset=utf-8 +Connection: keep-alive + + + + Test + + +

This is a photo post with an img tag inside the content.

+ +