Testing collections in PHPUnit

Code
<?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);
    }
}
Result
Time: 00:00.005, Memory: 18.00 MB

OK (1 test, 0 assertions)
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8