-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <[email protected]> # Conflicts: # .all-contributorsrc # CONTRIBUTORS.md
- Loading branch information
Showing
7 changed files
with
143 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Tests\Feature\Console; | ||
|
||
use Illuminate\Support\Facades\Artisan; | ||
use Tests\TestCase; | ||
|
||
class OptimizeTest extends TestCase | ||
{ | ||
public function testOptimizeSucceeds() | ||
{ | ||
$this->artisan('optimize')->assertSuccessful(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |