feat(blog): add representation blog management features including listing, creating, and editing blogs
This commit is contained in:
@@ -109,6 +109,25 @@ class BlogV2FieldsTest extends ApiTestCase
|
||||
$this->assertNotContains("مالB-$tag", $titles, "another rep's post leaked");
|
||||
}
|
||||
|
||||
public function testRepresentativeCanGetOwnPostButNotOthers(): void
|
||||
{
|
||||
$yasuj = $this->makeCity('یاسوج');
|
||||
$repA = $this->makeRepresentation([$yasuj]);
|
||||
$repB = $this->makeRepresentation([$yasuj]);
|
||||
|
||||
$created = $this->authJson('POST', '/api/v1/representation/blog', $repA->getUser(), [
|
||||
'title' => 'مقالهٔ A', 'body' => 'متن آزمایشی مقاله برای تست', 'city_id' => $yasuj->getId(),
|
||||
]);
|
||||
$uuid = $created['data']['data']['uuid'];
|
||||
|
||||
$own = $this->authJson('GET', "/api/v1/representation/blog/$uuid", $repA->getUser());
|
||||
$this->assertSame(200, $this->responseCode());
|
||||
$this->assertSame('مقالهٔ A', $own['data']['data']['title']);
|
||||
|
||||
$this->authJson('GET', "/api/v1/representation/blog/$uuid", $repB->getUser());
|
||||
$this->assertSame(404, $this->responseCode());
|
||||
}
|
||||
|
||||
public function testRepresentativeCannotEditOthersPost(): void
|
||||
{
|
||||
$yasuj = $this->makeCity('یاسوج');
|
||||
|
||||
Reference in New Issue
Block a user