Пример #1
0
 /**
  * @depends test_createComp
  */
 public function test_createPhotos($photoComp)
 {
     $PhotoOfTheWeek = new PhotoOfTheWeek();
     $PhotoOfTheWeek->getStartOfWeek();
     $Exif = new Exif();
     $i = 1;
     foreach ($this->ids as $id) {
         $User = $this->test_createUser(sprintf("username-%s", $id), sprintf("*****@*****.**", $id));
         $Image = ImageFactory::CreateImage($id, "flickr", Images::OPT_REFRESH);
         $this->assertTrue($photoComp->canUserSubmitPhoto($User));
         $this->assertFalse($photoComp->isImageInCompetition($Image));
         $photoComp->submitPhoto($Image, $User);
         $this->assertFalse($photoComp->canUserSubmitPhoto($User));
         $this->assertTrue($photoComp->isImageInCompetition($Image));
         $this->assertEquals($User->id, $photoComp->getPhotoAuthor($Image)->id);
         $this->assertTrue($photoComp->isImageOwnedBy($User, $Image));
         $photoComp->getNumVotesForUser($User);
         $this->assertEquals(1, $photoComp->getNumPendingSubmissions());
         $photoComp->approveSubmission($Image);
         $photoComp->getPendingSubmissions();
         $this->assertEquals(0, $photoComp->getNumPendingSubmissions());
         $this->assertEquals(0, $photoComp->getNumVotesForImage($Image));
         $photoComp->getPhotoContext($Image);
         $this->assertEquals(1, $photoComp->getPhoto($Image)->status);
         $this->assertEquals($i, count($photoComp->getPhotosAsArray(true)));
         $i++;
         $PhotoOfTheWeek->NominateImage($Image, new DateTime(), $User);
         $PhotoOfTheWeek->isPhotoOfTheWeek($Image);
         $exif = $Exif->getImageExif($Image, true);
         $exif = $Exif->formatExif($exif);
     }
     $PhotoOfTheWeek->getImageOfTheWeek();
     $PhotoOfTheWeek->getPreviousPhotos();
     $photoComp->getPendingSubmissions();
     $this->assertEquals(0, $photoComp->getNumPendingSubmissions());
     foreach ($this->ids as $id) {
         $Image = ImageFactory::CreateImage($id, "flickr");
         $photoComp->rejectSubmission($Image);
         Debug::LogCLI("Rejected image " . $Image->id);
         break;
     }
     $photoComp->getArray();
     $photoComp->getPhotosAsArray();
     $photoComp->getPhotosAsArrayByVotes();
     $photoComp->getSiteMessage();
     $photoComp->getWinningPhoto();
     return $photoComp;
 }