/** * @param \_OurBrand_\Quiz\Domain\Model\Exercises\MatchPictureInPictureExercise $exercise * @return void */ private function previewAssignment($exercise) { $shapes = $exercise->getRandomShapes(); $this->view->assign('shapes', $shapes); $this->view->assign('solvedShapes', json_encode(array())); // there are no already answered data in preview $this->view->assign('explanationTranslateKey', 'exerciseType.matchPictureInPicture.explanation'); $this->view->assign('currentExercise', $exercise); $this->view->assign('quiz', $exercise->getQuiz()); }
/** * @dataProvider shapesDataProvider * @param $shapeArray * @param $assertions */ public function testGetRandomShapes($shapeArray, $assertions) { $exercise = new MatchPictureInPictureExercise(); $this->assertNull($exercise->addShapesFromArray($shapeArray)); $randomShapes = $exercise->getRandomShapes(); // Check that number match $this->assertCount(count($randomShapes), $exercise->getShapes()); // Check that each shape has the correct attributes foreach ($randomShapes as $shape) { $this->assertTrue(method_exists($shape, 'getX'), 'object doent have method: getX()'); $this->assertTrue(method_exists($shape, 'getY'), 'object doent have method: getY()'); $this->assertTrue(method_exists($shape, 'getType'), 'object doent have method: getType()'); $this->assertTrue(method_exists($shape, 'getImage'), 'object doent have method: getImage()'); $this->assertTrue(method_exists($shape, 'getActive'), 'object doent have method: getActive()'); $this->assertTrue(method_exists($shape, 'getAttributes'), 'object doent have method: getAttributes()'); } }