jeudi 8 décembre 2016

Laravel Eloquent, assert that collection contains item

How to assert (in PHPUnit test) that Eloquent collection contains an item?

Something like this:

$expected = factory::create(Item::class)->create();
$eloquentCollection = someData(); // Item::orderBy(...)->...->get();
$this->assertContains($expected, $eloquentCollection);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire