Squashed commit of the following:
commit a01812b0d709e556af060a393168acc471aca774
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date: Thu Apr 12 18:15:25 2018 +0100
Improve JSON feed generation to better match the spec
commit 72ad2c629738ef73ccaf984ed3ad9b726956dd71
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date: Sun Apr 8 13:07:48 2018 +0100
Add a test for null title entries
This commit is contained in:
parent
97a6b771f8
commit
3d1ae20afb
3 changed files with 56 additions and 2 deletions
|
|
@ -71,4 +71,28 @@ class FeedsTest extends TestCase
|
|||
$response = $this->get('/notes/feed.json');
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Each JSON feed item must have one of `content_text` or `content_html`,
|
||||
* and whichever one they have can’t be `null`.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_json_feed_has_one_content_attribute_and_it_isnt_null()
|
||||
{
|
||||
$response = $this->get('/notes/feed.json');
|
||||
$data = json_decode($response->content());
|
||||
foreach ($data->items as $item) {
|
||||
$this->assertTrue(
|
||||
property_exists($item, 'content_text') ||
|
||||
property_exists($item, 'content_html')
|
||||
);
|
||||
if (property_exists($item, 'content_text')) {
|
||||
$this->assertNotNull($item->content_text);
|
||||
}
|
||||
if (property_exists($item, 'content_html')) {
|
||||
$this->assertNotNull($item->content_html);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue