public function testSetThread() { // new entity $post = new Post(); // dummy entity $thread = new Thread(); $thread->setSubject("hehe"); // Use the setThread method $post->setThread($thread); // Assert the result $this->assertEquals($thread, $post->getThread()); }
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); } } }