/** * @covers Core\Entity\SubjectRound::addTeacher * @covers Core\Entity\SubjectRound::removeTeacher */ public function testAddRemoveTeacher() { $sr = new SubjectRound(); $this->assertEquals(0, $sr->getTeacher()->count()); $mockTeacher = $this->getMockBuilder('Core\\Entity\\Teacher')->getMock(); $teachers = new \Doctrine\Common\Collections\ArrayCollection(); $teachers->add($mockTeacher); $sr->addTeacher($teachers); $this->assertEquals(1, $sr->getTeacher()->count()); $this->assertEquals($mockTeacher, $sr->getTeacher()->first()); $sr->removeTeacher($teachers); $this->assertEquals(0, $sr->getTeacher()->count()); }
/** * {@inheritDoc} */ public function addTeacher(\Doctrine\Common\Collections\Collection $teachers) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'addTeacher', array($teachers)); return parent::addTeacher($teachers); }