/** * @test */ public function get_all_participants_check() { $obj = new Conversation(); $msg1 = new Message(); $msg1->setSender(5); $msg2 = new Message(); $msg2->setSender(8); $msg3 = new Message(); $msg3->setSender(11); $msg4 = new Message(); $msg4->setSender(11); $obj->addMessage($msg1); $participants = $obj->getAllParticipants(); $this->assertEquals(1, sizeof($participants)); $this->assertEquals(['5' => 0], array_flip($participants)); $obj->addMessage($msg2); $participants = $obj->getAllParticipants(); $this->assertEquals(2, sizeof($participants)); $this->assertEquals(['5' => 0, '8' => 1], array_flip($participants)); $obj->addMessage($msg3); $participants = $obj->getAllParticipants(); $this->assertEquals(3, sizeof($participants)); $this->assertEquals(['5' => 0, '8' => 1, '11' => 2], array_flip($participants)); $obj->addMessage($msg4); $participants = $obj->getAllParticipants(); $this->assertEquals(3, sizeof($participants)); $this->assertEquals(['5' => 0, '8' => 1, '11' => 2], array_flip($participants)); }