/** * @param \_OurBrand_\Quiz\Domain\Model\Exercises\SpellingAndGrammarCommaQuestion $question */ public function addQuestion($question) { $question->setExercise($this); $question->setNumber(count($this->questions)); $this->questions->add($question); $this->maxScore = count($this->questions); }
public function testGetNumber() { $sng = new SpellingAndGrammarCommaQuestion(); $number = 1; $this->assertNull($sng->setNumber($number)); $this->assertSame($number, $sng->getNumber()); }
/** * @dataProvider readyForCompletionDataProvider * @param array $data1 * @param array $data2 * @param integer $expected */ public function testGetReadyForCompletion($data1, $data2, $expected) { $exercise = new SpellingAndGrammarCommaExercise(); if (!empty($data1)) { $exercise->setTitle($data1['title']); $exercise->setDescription($data1['description']); } if (!empty($data2)) { foreach ($data2 as $row) { $question = new SpellingAndGrammarCommaQuestion(); $question->setQuestionWithComma($row['questionWithComma']); $question->setQuestionWithoutComma($row['questionWithoutComma']); $exercise->addQuestion($question); } } $this->assertSame($expected, $exercise->getReadyForCompletion()); }