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