mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 16:23:37 +08:00
Add test for discussion posts being deleted on discussion delete from DB
This commit is contained in:
parent
82562294b7
commit
3526083320
|
@ -25,7 +25,9 @@ class DeleteDiscussionControllerTest extends ApiControllerTestCase
|
||||||
'discussions' => [
|
'discussions' => [
|
||||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2],
|
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2],
|
||||||
],
|
],
|
||||||
'posts' => [],
|
'posts' => [
|
||||||
|
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>'],
|
||||||
|
],
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
$this->adminUser(),
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
|
@ -50,4 +52,16 @@ class DeleteDiscussionControllerTest extends ApiControllerTestCase
|
||||||
|
|
||||||
$this->assertEquals(204, $response->getStatusCode());
|
$this->assertEquals(204, $response->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function deleting_discussions_deletes_their_posts()
|
||||||
|
{
|
||||||
|
$this->actor = User::find(1);
|
||||||
|
|
||||||
|
$this->callWith([], ['id' => 1]);
|
||||||
|
|
||||||
|
$this->assertNull($this->database()->table('posts')->find(1), 'Post exists in the DB');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user