/** * @test */ public function removePostFromObjectStorageHoldingPosts() { $post = new \Pluswerk\Simpleblog\Domain\Model\Post(); $postsObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('detach'), array(), '', FALSE); $postsObjectStorageMock->expects($this->once())->method('detach')->with($this->equalTo($post)); $this->inject($this->subject, 'posts', $postsObjectStorageMock); $this->subject->removePost($post); }
/** * @param \Pluswerk\Simpleblog\Domain\Model\Blog $blog * @param \Pluswerk\Simpleblog\Domain\Model\Post $post */ public function deleteAction(\Pluswerk\Simpleblog\Domain\Model\Blog $blog, \Pluswerk\Simpleblog\Domain\Model\Post $post) { $blog->removePost($post); $this->objectManager->get('Pluswerk\\Simpleblog\\Domain\\Repository\\BlogRepository')->update($blog); $this->postRepository->remove($post); $this->redirect('show', 'Blog', NULL, array('blog' => $blog)); }