Test for #58
This commit is contained in:
parent
937db919ac
commit
b1353554eb
|
|
@ -115,7 +115,8 @@ class ReportControllerTest extends TestCase
|
||||||
public function testReview()
|
public function testReview()
|
||||||
{
|
{
|
||||||
$uploader = factory(User::class)->create();
|
$uploader = factory(User::class)->create();
|
||||||
$reporter = factory(User::class, 'admin')->create();
|
$reporter = factory(User::class)->create();
|
||||||
|
$admin = factory(User::class, 'admin')->create();
|
||||||
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
|
$texture = factory(Texture::class)->create(['uploader' => $uploader->uid]);
|
||||||
|
|
||||||
$report = new Report;
|
$report = new Report;
|
||||||
|
|
@ -128,7 +129,7 @@ class ReportControllerTest extends TestCase
|
||||||
$report->refresh();
|
$report->refresh();
|
||||||
|
|
||||||
// Without `id` field
|
// Without `id` field
|
||||||
$this->actingAs($reporter)
|
$this->actingAs($admin)
|
||||||
->postJson('/admin/reports')
|
->postJson('/admin/reports')
|
||||||
->assertJsonValidationErrors('id');
|
->assertJsonValidationErrors('id');
|
||||||
|
|
||||||
|
|
@ -200,9 +201,7 @@ class ReportControllerTest extends TestCase
|
||||||
option(['reporter_reward_score' => 6]);
|
option(['reporter_reward_score' => 6]);
|
||||||
$report->refresh();
|
$report->refresh();
|
||||||
$report->status = Report::PENDING;
|
$report->status = Report::PENDING;
|
||||||
$report->reporter = $uploader->uid; // I REPORT MYSELF. (我 举 报 我 自 己)
|
|
||||||
$report->save();
|
$report->save();
|
||||||
$reporter = $uploader;
|
|
||||||
$score = $reporter->score;
|
$score = $reporter->score;
|
||||||
$this->postJson('/admin/reports', ['id' => $report->id, 'action' => 'ban'])
|
$this->postJson('/admin/reports', ['id' => $report->id, 'action' => 'ban'])
|
||||||
->assertJson([
|
->assertJson([
|
||||||
|
|
@ -211,6 +210,7 @@ class ReportControllerTest extends TestCase
|
||||||
'data' => ['status' => Report::RESOLVED],
|
'data' => ['status' => Report::RESOLVED],
|
||||||
]);
|
]);
|
||||||
$reporter->refresh();
|
$reporter->refresh();
|
||||||
|
$uploader->refresh();
|
||||||
$this->assertEquals(User::BANNED, $uploader->permission);
|
$this->assertEquals(User::BANNED, $uploader->permission);
|
||||||
$this->assertEquals($score + 6, $reporter->score);
|
$this->assertEquals($score + 6, $reporter->score);
|
||||||
option(['reporter_reward_score' => 0]);
|
option(['reporter_reward_score' => 0]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user