public function testRemoveSemester() { // new entity $department = new Department(); $semester1 = new Semester(); $semester1->setSemesterTime("Høst"); $semester2 = new Semester(); $semester2->setSemesterTime("Vår"); $semester3 = new Semester(); $semester3->setSemesterTime("Vår"); // Use the addSemester method $department->addSemester($semester1); $department->addSemester($semester2); $department->addSemester($semester3); // Remove $semester1 from department $department->removeSemester($semester1); // Semesters are stored in an array $semesters = $department->getSemesters(); // Loop through the array foreach ($semesters as $semester) { // Assert the result $this->assertNotEquals($semester1, $semester); } }