public function updatePopularityCount() { $imageService = new ImageService(); $images = $imageService->getImagesByTag($this->name); $this->popularity_count = count($images); $this->save(); }
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))); }
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(); } }
/** * @expectedException \TigerKit\TigerException * @expectedExceptionMessage No such tag 'bogus'. */ public function testGetImagesByInvalidTag() { $this->imageService->getImagesByTag("bogus"); }