Browse Source

add failing test for `p-content` containing an `u-photo`

pull/60/head
Aaron Parecki 7 years ago
parent
commit
85c2b9b15f
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 26 additions and 0 deletions
  1. +12
    -0
      tests/SanitizeTest.php
  2. +14
    -0
      tests/data/sanitize.example/photo-in-text-content

+ 12
- 0
tests/SanitizeTest.php View File

@ -167,6 +167,18 @@ class SanitizeTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('This is a photo post with an <code>img</code> 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);

+ 14
- 0
tests/data/sanitize.example/photo-in-text-content View File

@ -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
<html>
<head>
<title>Test</title>
</head>
<body class="h-entry">
<p class="p-content p-name">This is a photo post with an <code>img</code> tag inside the content. <img class="u-photo" src="http://target.example.com/photo.jpg"></p>
</body>
</html>

Loading…
Cancel
Save