/** * @test */ public function addCategoryToObjectStorageHoldingCategory() { $category = new \DERHANSEN\SfBanners\Domain\Model\Category(); $categoryObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('attach'), array(), '', false); $categoryObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($category)); $this->inject($this->fixture, 'category', $categoryObjectStorageMock); $this->fixture->addCategory($category); }