Exemplo n.º 1
0
 /**
  * @test
  */
 public function addPostToObjectStorageHoldingPosts()
 {
     $post = new \Pluswerk\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);
 }
 /**
  * @param \Pluswerk\Simpleblog\Domain\Model\Blog $blog
  * @param \Pluswerk\Simpleblog\Domain\Model\Post $post
  */
 public function addAction(\Pluswerk\Simpleblog\Domain\Model\Blog $blog, \Pluswerk\Simpleblog\Domain\Model\Post $post)
 {
     //$post->setPostdate(new \DateTime());
     //$this->postRepository->add($post);
     $post->setAuthor($this->objectManager->get('Pluswerk\\Simpleblog\\Domain\\Repository\\AuthorRepository')->findOneByUid($GLOBALS['TSFE']->fe_user->user['uid']));
     $blog->addPost($post);
     $this->objectManager->get('Pluswerk\\Simpleblog\\Domain\\Repository\\BlogRepository')->update($blog);
     $this->redirect('show', 'Blog', NULL, array('blog' => $blog));
 }