public function testRemoveSchool() { // new entity $department = new Department(); $school1 = new School(); $school1->setName("School1"); $school2 = new School(); $school2->setName("school2"); $school3 = new School(); $school3->setName("school3"); // Use the addSchool method $department->addSchool($school1); $department->addSchool($school2); $department->addSchool($school3); // Remove $school1 from department $department->removeSchool($school1); // Schools are stored in an array $schools = $department->getSchools(); // Loop through the array foreach ($schools as $school) { // Assert the result $this->assertNotEquals($school1, $school); } }