diff --git a/tests/SanitizeTest.php b/tests/SanitizeTest.php index 62e499a..e26b1bd 100644 --- a/tests/SanitizeTest.php +++ b/tests/SanitizeTest.php @@ -177,8 +177,6 @@ class SanitizeTest extends PHPUnit_Framework_TestCase { $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); @@ -224,6 +222,22 @@ class SanitizeTest extends PHPUnit_Framework_TestCase { $body = $response->getContent(); $this->assertEquals(200, $response->getStatusCode()); $data = json_decode($body); +print_r($data); + + $this->assertObjectHasAttribute('name', $data->data); + $this->assertEquals('Oh, how well they know me! 🥃', $data->data->name); + $this->assertObjectNotHasAttribute('content', $data->data); + $this->assertEquals('https://cleverdevil.io/file/5bf2fa91c3d4c592f9978200923cb56e/thumb.jpg', $data->data->photo[0]); + } + + public function testPhotoWithDupeNameAndAlt() { + $url = 'http://sanitize.example/photo-with-dupe-name-alt'; + $response = $this->parse(['url' => $url]); + + $body = $response->getContent(); + $this->assertEquals(200, $response->getStatusCode()); + $data = json_decode($body); +echo json_encode($data->data, JSON_PRETTY_PRINT+JSON_UNESCAPED_SLASHES); $this->assertObjectHasAttribute('name', $data->data); $this->assertEquals('Oh, how well they know me! 🥃', $data->data->name); diff --git a/tests/data/sanitize.example/photo-with-dupe-name-alt b/tests/data/sanitize.example/photo-with-dupe-name-alt new file mode 100644 index 0000000..85a203c --- /dev/null +++ b/tests/data/sanitize.example/photo-with-dupe-name-alt @@ -0,0 +1,15 @@ +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 + + +

Photo caption

+

Photo caption

+ +