mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 12:17:05 -08:00
Added unaccepted asset test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
d21ebc6f0d
commit
b68fcf1de5
61
tests/Feature/Reporting/UnacceptedAssetReportTest.php
Normal file
61
tests/Feature/Reporting/UnacceptedAssetReportTest.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Reporting;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Illuminate\Testing\TestResponse;
|
||||
use League\Csv\Reader;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UnacceptedAssetReportTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
TestResponse::macro(
|
||||
'assertSeeTextInStreamedResponse',
|
||||
function (string $needle) {
|
||||
Assert::assertTrue(
|
||||
collect(Reader::createFromString($this->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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue