Esempio n. 1
0
 public function testOutput()
 {
     $helper = new SlotsHelper();
     $helper->set('foo', 'bar');
     ob_start();
     $ret = $helper->output('foo');
     $output = ob_get_clean();
     $this->assertEquals('bar', $output, '->output() outputs the content of a slot');
     $this->assertTrue($ret, '->output() returns true if the slot exists');
     ob_start();
     $ret = $helper->output('bar', 'bar');
     $output = ob_get_clean();
     $this->assertEquals('bar', $output, '->output() takes a default value to return if the slot does not exist');
     $this->assertTrue($ret, '->output() returns true if the slot does not exist but a default value is provided');
     ob_start();
     $ret = $helper->output('bar');
     $output = ob_get_clean();
     $this->assertEquals('', $output, '->output() outputs nothing if the slot does not exist');
     $this->assertFalse($ret, '->output() returns false if the slot does not exist');
 }