Beispiel #1
0
 public function testGetImage()
 {
     $user = new \FelixOnline\Core\User('jk708');
     $image = $user->getImage();
     $this->assertInstanceOf('FelixOnline\\Core\\Image', $image);
 }
Beispiel #2
0
 public function testReplyCommentNotification()
 {
     $faker = Faker\Factory::create();
     $content = $faker->text;
     $article = new \FelixOnline\Core\Article(1);
     $user = new \FelixOnline\Core\User('jk708');
     $comment = new \FelixOnline\Core\Comment();
     $replyingto = new \FelixOnline\Core\Comment(1);
     $count = 0;
     $test = $this;
     $emailMock = $this->mock('\\Swift_Mailer')->send(function ($message) use($test, $article, $user, $replyingto, &$count) {
         // reply email is sent first
         if ($count == 0) {
             $test->assertGreaterThanOrEqual(0, strpos($message->getSubject(), $article->getTitle()));
             $test->assertGreaterThanOrEqual(0, strpos($message->getSubject(), $user->getName()));
             $test->assertNotEmpty($message->getBody());
             $test->assertArrayHasKey($replyingto->getUser()->getEmail(), $message->getTo());
         }
         $count++;
         return true;
     }, $this->exactly(2))->new();
     $this->app['email'] = $emailMock;
     $comment = $comment->setUser($user)->setComment($content)->setArticle($article)->setReply($replyingto);
     $comment->save();
     $comment->emailAuthors();
     $comment->emailReply();
 }