/** * Method to test render(). * * @return void * * @covers \Windwalker\Helper\ProfilerHelper::render */ public function testRender() { $namespace = 'unit-test'; $buffer = array('foo', 'bar', 'foobar'); $expected = "<pre><h3>WindWalker Debug [namespace: unit-test]: </h3>foo\n<br />\nbar\n<br />\nfoobar</pre>"; $mockProfiler = $this->getMockBuilder('JProfiler')->setConstructorArgs(array($namespace))->getMock(); /** @var \JProfiler $mockProfiler */ $mockProfiler->method('getBuffer')->willReturn($buffer); // Set mocked profiler instance ProfilerHelper::setProfiler($namespace, $mockProfiler); $this->assertSame($expected, ProfilerHelper::render($namespace, true)); ob_start(); $return = ProfilerHelper::render($namespace); $actual = ob_get_contents(); ob_end_clean(); $this->assertSame($expected, $actual); $this->assertSame('', $return); }