/** * @test */ public function addPostToObjectStorageHoldingPosts() { $post = new \Lobcher\Simpleblog\Domain\Model\Post(); $postsObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('attach'), array(), '', FALSE); $postsObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($post)); $this->inject($this->subject, 'posts', $postsObjectStorageMock); $this->subject->addPost($post); }