mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-06 22:50:07 +00:00
131 - Asserting Against Sort Order
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Exceptions\Handler;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Illuminate\Foundation\Testing\TestResponse;
|
||||
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
|
||||
|
||||
abstract class TestCase extends \Illuminate\Foundation\Testing\TestCase
|
||||
{
|
||||
@@ -30,6 +31,23 @@ abstract class TestCase extends \Illuminate\Foundation\Testing\TestCase
|
||||
TestResponse::macro('assertViewIs', function ($name) {
|
||||
Assert::assertEquals($name, $this->original->name());
|
||||
});
|
||||
|
||||
EloquentCollection::macro('assertContains', function ($value) {
|
||||
Assert::assertTrue($this->contains($value), "Failed asserting that the collection contains the specified value.");
|
||||
});
|
||||
|
||||
EloquentCollection::macro('assertNotContains', function ($value) {
|
||||
Assert::assertFalse($this->contains($value), "Failed asserting that the collection does not contain the specified value.");
|
||||
});
|
||||
|
||||
EloquentCollection::macro('assertEquals', function ($items) {
|
||||
Assert::assertEquals(count($this), count($items));
|
||||
|
||||
$this->zip($items)->each(function ($pair) {
|
||||
list($a, $b) = $pair;
|
||||
Assert::assertTrue($a->is($b));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected function disableExceptionHandling()
|
||||
|
||||
Reference in New Issue
Block a user