collection = new class() implements CollectionAttributInterface { use CollectionAttribut; }; } public function testConstructor(): void { $this->expectException(\TypeError::class); $this->collection->getCollection(); } public function testAccessors(): void { $collection = new ArrayCollection(); $this->assertNull($this->collection->setCollection($collection)); $this->assertEquals($collection, $this->collection->getCollection()); } public function testAdd():void{ $mock = new class{}; $this->collection->setCollection(new ArrayCollection()); $this->assertTrue($this->collection->getCollection()->add($mock)); $this->assertEquals($mock, $this->collection->getCollection()->get(0)); } }