snipe-it/tests/Support/InteractsWithResponses.php

20 lines
596 B
PHP
Raw Normal View History

2023-06-07 16:16:30 -07:00
<?php
namespace Tests\Support;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Testing\TestResponse;
trait InteractsWithResponses
{
private function assertResponseContainsInRows(TestResponse $response, Model $model, string $field = 'name')
{
$this->assertTrue(collect($response['rows'])->pluck($field)->contains($model->{$field}));
}
private function assertResponseDoesNotContainInRows(TestResponse $response, Model $model, string $field = 'name')
{
$this->assertFalse(collect($response['rows'])->pluck($field)->contains($model->{$field}));
}
}