public function testAddThread() { // new entity $subforum = new Subforum(); // New dummy entity $thread1 = new Thread(); $thread1->setSubject("thread1"); // Use the addThread method $subforum->addThread($thread1); // Threads is stored in an array $threads = $subforum->getThreads(); // Loop through the array and check for matches foreach ($threads as $thread) { if ($thread1 == $thread) { // Assert the result $this->assertEquals($thread1, $thread); } } }