From b68fcf1de5958b4739eb34856626709ad09f6f11 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 12 Jul 2024 12:19:40 +0100 Subject: [PATCH] Added unaccepted asset test Signed-off-by: snipe --- .../Reporting/UnacceptedAssetReportTest.php | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/Feature/Reporting/UnacceptedAssetReportTest.php diff --git a/tests/Feature/Reporting/UnacceptedAssetReportTest.php b/tests/Feature/Reporting/UnacceptedAssetReportTest.php new file mode 100644 index 0000000000..b3ec0b2e0b --- /dev/null +++ b/tests/Feature/Reporting/UnacceptedAssetReportTest.php @@ -0,0 +1,61 @@ +streamedContent())->getRecords()) + ->pluck(0) + ->contains($needle) + ); + + return $this; + } + ); + + TestResponse::macro( + 'assertDontSeeTextInStreamedResponse', + function (string $needle) { + Assert::assertFalse( + collect(Reader::createFromString($this->streamedContent())->getRecords()) + ->pluck(0) + ->contains($needle) + ); + + return $this; + } + ); + } + + + public function testPermissionRequiredToViewUnacceptedAssetReport() + { + $this->actingAs(User::factory()->create()) + ->get(route('reports/unaccepted_assets')) + ->assertForbidden(); + } + + public function testUserCanListUnacceptedAssets() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get(route('reports/unaccepted_assets')) + ->assertOk(); + } + +}