예제 #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());
 }
 /**
  * Generate testData
  *
  * This command inserts all the required data to start testing the student view of the Dictation exercise
  *
  * @return void
  */
 public function generateInsertCommand()
 {
     $quiz = new Quiz();
     $quiz->setTitle('Dictation Insert');
     $quiz->setAuthor('Test Instructor');
     $quiz->setCreator('instructor');
     $quiz->setIsDraft(false);
     $quiz->setType(0);
     $exercise = new InsertDictationExercise();
     $exercise->setTitle('Spelling and Grammer: Insert Dictation');
     $exercise->setDescription('Description');
     $snippet = new DictationSnippet();
     $snippet->setText('<span class="textShow">This is a very</span> <span class="textmark">marvellous</span> horse');
     $markedText = new MarkedText();
     $markedText->setText('marvellous');
     $snippet->addMarkedText($markedText);
     $exercise->addSnippet($snippet);
     $snippet = new DictationSnippet();
     $snippet->setText('<span class="textShow">This is another</span> <span class="textmark">sentence</span> horse');
     $markedText = new MarkedText();
     $markedText->setText('sentence');
     $snippet->addMarkedText($markedText);
     $exercise->addSnippet($snippet);
     $snippet = new DictationSnippet();
     $snippet->setText('<span class="textmark">Newest</span> <span class="textShow">more</span><span class="textmark">text</span>');
     $markedText = new MarkedText();
     $markedText->setText('Newest');
     $snippet->addMarkedText($markedText);
     $markedText = new MarkedText();
     $markedText->setText('text');
     $snippet->addMarkedText($markedText);
     $exercise->addSnippet($snippet);
     $quiz->addExercise($exercise);
     $this->quizRepository->add($quiz);
     //Create QuizSession
     $quizSession = new QuizSession();
     $quizSession->setQuiz($quiz);
     $quizSession->setInstructor('instructor');
     $quizSession->setStudentCanSeeSummaryAndReviewExercises(1);
     $quizSession->setShowGradeOnSummary(1);
     $this->quizSessionRepository->add($quizSession);
     //Create studentQuizSession
     $studentQuizSession = new StudentQuizSession();
     $studentQuizSession->setQuizSession($quizSession);
     $studentQuizSession->setStudent('student');
     $this->studentQuizSessionRepository->add($studentQuizSession);
 }