/** * @test */ public function addCommentToObjectStorageHoldingComments() { $comment = new \Lobcher\Simpleblog\Domain\Model\Comment(); $commentsObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('attach'), array(), '', FALSE); $commentsObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($comment)); $this->inject($this->subject, 'comments', $commentsObjectStorageMock); $this->subject->addComment($comment); }