<?php
use PHPUnit\Framework\TestCase;
class Foo{}
class CollectionTypeTest extends TestCase
{
public function testCollection() : void
{
$collection = [
new Foo(),
new Foo(),
new Foo(),
];
$iterator = new ArrayIterator(
$collection
);
// assertCount/assertNotCount works on
// Traversable too
$this->assertNotCount(0, $collection);
$this->assertNotCount(0, $iterator);
// collection with no elements is not
// covered by this assert
$this->assertContainsOnlyInstancesOf('Foo', $collection);
$this->assertContainsOnlyInstancesOf('Foo', $iterator);
}
}