Add a test for JSON request to endpoint

This commit is contained in:
Jonny Barnes 2016-07-11 17:32:58 +01:00
parent 72e61032d8
commit 7d381eaf81
2 changed files with 20 additions and 1 deletions

View file

@ -100,6 +100,25 @@ class MicropubTest extends TestCase
$this->seeInDatabase('places', ['slug' => 'the-barton-arms']);
}
public function testMicropubJSONRequestCreateNewNote()
{
$faker = \Faker\Factory::create();
$note = $faker->text;
$this->json(
'POST',
$this->appurl . '/api/post',
[
'type' => ['h-entry'],
'properties' => [
'content' => [$note],
],
],
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
)->seeJson([
'response' => 'created'
]);
}
private function getToken()
{
$signer = new Sha256();