Ejemplo n.º 1
0
 /**
  * @test
  *
  * $this->getMock('\_OurBrand_\Quiz\Domain\Model\')
  */
 public function testGetters()
 {
     $level = $this->getMock('\\_OurBrand_\\Quiz\\Domain\\Model\\TeamLevel', array(), array('Test teamlevel', 1));
     $imageResource = $this->getMock('\\_OurBrand_\\Quiz\\Domain\\Model\\ImageResource');
     $lastEdited = new \DateTime();
     $quiz = new \_OurBrand_\Quiz\Domain\Model\Quiz();
     $quiz->setType(1);
     $quiz->setDuration(300);
     $quiz->setTitle('Quiz Title');
     $quiz->setWasCopyOf('Original Title');
     $quiz->setAuthor('Tester');
     $quiz->setBannerImage($imageResource);
     $quiz->setIntroduction('Introduction test');
     $quiz->setDescription('Description test');
     $quiz->setCreator('Creator');
     $quiz->setIsLanguage(1);
     $quiz->setLastEdited($lastEdited);
     $quiz->setSharing(1);
     $quiz->setIsDraft(1);
     $quiz->setIsDeleted(0);
     $this->assertEquals(1, $quiz->getType());
     $this->assertEquals(300, $quiz->getDuration());
     $this->assertEquals('Quiz Title', $quiz->getTitle());
     $this->assertEquals('Original Title', $quiz->getWasCopyOf());
     $this->assertEquals('Tester', $quiz->getAuthor());
     $this->assertEquals($imageResource, $quiz->getBannerImage());
     $this->assertEquals('Introduction test', $quiz->getIntroduction());
     $this->assertEquals('Description test', $quiz->getDescription());
     $this->assertEquals('Creator', $quiz->getCreator());
     $this->assertEquals(1, $quiz->getIsLanguage());
     $this->assertEquals($lastEdited->getTimestamp(), $quiz->getLastEdited()->getTimestamp());
     $this->assertEquals(1, $quiz->getSharing());
     $this->assertEquals(1, $quiz->getIsDraft());
     $this->assertEquals(0, $quiz->getIsDeleted());
 }
Ejemplo n.º 2
0
 /**
  * @param \_OurBrand_\Quiz\Domain\Model\Quiz $quiz
  *
  * @return array
  */
 private function makeExportArrayFromQuiz($quiz)
 {
     $thumbnailMaxWidth = 200;
     $thumbnailMaxHeight = 200;
     $previewImage = $quiz->getBannerImage() ? $quiz->getBannerImage()->getThumbNail($thumbnailMaxWidth, $thumbnailMaxHeight)->getOriginalResource() : null;
     $outQuiz = array('__identifier' => $this->persistenceManager->getIdentifierByObject($quiz), 'title' => $quiz->getTitle(), 'bannerImage' => $this->resourcePublisher->getPersistentResourceWebUri($previewImage), 'subject' => $quiz->getSubject(), 'numberOfExercises' => $quiz->getExercises()->count());
     return $outQuiz;
 }