Allow micropub to post notes and articles
This commit is contained in:
parent
5eed665801
commit
ca6205d2a6
9 changed files with 102 additions and 49 deletions
|
@ -675,7 +675,7 @@ class MicropubControllerTest extends TestCase
|
|||
}
|
||||
|
||||
/** @test */
|
||||
public function micropubClientWebReauestCanEncodeTokenWithinTheForm(): void
|
||||
public function micropubClientWebRequestCanEncodeTokenWithinTheForm(): void
|
||||
{
|
||||
$faker = Factory::create();
|
||||
$note = $faker->text;
|
||||
|
@ -691,4 +691,32 @@ class MicropubControllerTest extends TestCase
|
|||
$response->assertJson(['response' => 'created']);
|
||||
$this->assertDatabaseHas('notes', ['note' => $note]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function micropubClientApiRequestCreatesArticlesWhenItIncludesTheNameProperty(): void
|
||||
{
|
||||
$faker = Factory::create();
|
||||
$name = $faker->text(50);
|
||||
$content = $faker->paragraphs(5, true);
|
||||
|
||||
$response = $this->postJson(
|
||||
'/api/post',
|
||||
[
|
||||
'type' => ['h-entry'],
|
||||
'properties' => [
|
||||
'name' => $name,
|
||||
'content' => $content,
|
||||
],
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
);
|
||||
|
||||
$response
|
||||
->assertJson(['response' => 'created'])
|
||||
->assertStatus(201);
|
||||
$this->assertDatabaseHas('articles', [
|
||||
'title' => $name,
|
||||
'main' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue