public function testPopPrefix() { $messagesLogged = array(); $this->object->setLogger(function ($msg, $writeln = true) use(&$messagesLogged) { $messagesLogged[] = $msg; }); //add 3 prefixes $this->object->pushPrefix('a'); $this->object->pushPrefix('b'); $this->object->pushPrefix('c'); //pop off 2 $this->object->popPrefix(); $this->object->popPrefix(); //log something $this->object->log('foo'); //we should see only the first prefix was used $this->assertEquals('a foo', $messagesLogged[0]); }