public function testCreateImageWithCreaterUpdater() { $mockAsset = __DIR__ . "/../Assets/sample-1.jpg"; $mockUpload = $this->makeMockUpload($mockAsset); $this->testUser->save(); User::setCurrent($this->testUser); $image = $this->imageService->uploadImage($this->testUser, $mockUpload); $image->save(); $this->assertEquals($this->testUser->user_id, $image->getCreatedUser()->user_id); $this->assertEquals($this->testUser->user_id, $image->getUpdatedUser()->user_id); }
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(); } }