Laravel Eloquent, assert that collection contains item : <p>How to assert (in PHPUnit test) that Eloquent collection contains an item?</p>

<p>Something like this:</p>

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