/**
  * @param \_OurBrand_\Quiz\Domain\Model\Exercises\MatchPictureInPictureExercise $exercise
  * @return void
  */
 private function editAssignment($exercise)
 {
     $exercise->setMediaContent('picture', false);
     // remove the standard add picture link in the top of the exercise
     $this->view->assign('mainImage', $exercise->getMainImage());
     $this->view->assign('existingShapes', $exercise->getShapesAsJson());
     $this->view->assign('currentExercise', $exercise);
     $this->view->assign('quiz', $exercise->getQuiz());
 }
 /**
  */
 public function testGetShapesAsJson()
 {
     $exercise = new MatchPictureInPictureExercise();
     // inactive shape
     $mockShape = $this->getMock('_OurBrand_\\Quiz\\Domain\\Model\\Exercises\\MatchPictureShape', array('getImageSrc', 'getType', 'getActive'));
     $mockShape->expects($this->any())->method('getImageSrc')->will($this->returnValue('mocked src'));
     $mockShape->expects($this->any())->method('getType')->will($this->returnValue('image'));
     $mockShape->expects($this->any())->method('getActive')->will($this->returnValue(false));
     $this->assertNull($exercise->addShape($mockShape), 'addShape()');
     // active shape
     $mockShape = $this->getMock('_OurBrand_\\Quiz\\Domain\\Model\\Exercises\\MatchPictureShape', array('getImageSrc', 'getType', 'getActive'));
     $mockShape->expects($this->any())->method('getImageSrc')->will($this->returnValue('mocked src'));
     $mockShape->expects($this->any())->method('getType')->will($this->returnValue('image'));
     $mockShape->expects($this->any())->method('getActive')->will($this->returnValue(true));
     $this->assertNull($exercise->addShape($mockShape), 'addShape()');
     $this->assertStringStartsWith('[{', $exercise->getShapesAsJson(true), 'returned string must start with [{');
     $this->assertStringEndsWith('}]', $exercise->getShapesAsJson(true), 'returned string must end with }]');
 }