예제 #1
0
 public function testRemoveFieldOfStudy()
 {
     // new entity
     $department = new Department();
     $fos1 = new FieldOfStudy();
     $fos1->setName("fos1");
     $fos2 = new FieldOfStudy();
     $fos2->setName("fos2");
     $fos3 = new FieldOfStudy();
     $fos3->setName("fos3");
     // Use the addFieldOfStudy method
     $department->addFieldOfStudy($fos1);
     $department->addFieldOfStudy($fos2);
     $department->addFieldOfStudy($fos3);
     // Remove $fos1 from department
     $department->removeFieldOfStudy($fos1);
     // Field of studies is stored in an array
     $fieldOfStudies = $department->getFieldOfStudy();
     // Loop through the array
     foreach ($fieldOfStudies as $study) {
         // Assert the result
         $this->assertNotEquals($fos1, $study);
     }
 }