예제 #1
0
파일: Tag.php 프로젝트: WolfGangS/TigerKit
 public function updatePopularityCount()
 {
     $imageService = new ImageService();
     $images = $imageService->getImagesByTag($this->name);
     $this->popularity_count = count($images);
     $this->save();
 }
예제 #2
0
 public function testAddCommentToImage()
 {
     $image = $this->imageService->getRandomImage();
     $comment = new Comment();
     $comment->comment = $this->faker->text(rand(100, 500));
     $comment->created_user_id = $this->randomCommentPoolUser()->user_id;
     $this->assertTrue($this->commentService->addCommentToImage($comment, $image) instanceof ImageCommentLink);
     $this->assertEquals(1, count($this->commentService->getComments($image)));
 }
예제 #3
0
 public function doUpload()
 {
     Models\User::checkLoggedIn();
     $user = Models\User::getCurrent();
     if ($user instanceof Models\User) {
         $imageService = new ImageService();
         $imageService->uploadImage($user, $_FILES['file']);
     } else {
         $this->slim->notFound();
     }
 }
예제 #4
0
 /**
  * @expectedException \TigerKit\TigerException
  * @expectedExceptionMessage No such tag 'bogus'.
  */
 public function testGetImagesByInvalidTag()
 {
     $this->imageService->getImagesByTag("bogus");
 }