phalApiHelperTracer = new PhalApi_Helper_Tracer(); } protected function tearDown() { DI()->debug = true; } /** * @group testMark */ public function testMark() { $tag = ''; $this->phalApiHelperTracer->mark($tag); $this->phalApiHelperTracer->mark('aHa~'); } /** * @group testGetReport */ public function testGetReport() { $rs = $this->phalApiHelperTracer->getStack(); $this->assertTrue(is_array($rs)); } public function testMixed() { $this->phalApiHelperTracer->mark('aHa~'); $this->phalApiHelperTracer->mark('BIU~'); $this->phalApiHelperTracer->mark('BlaBla~'); doSthForTrace($this->phalApiHelperTracer); $report = $this->phalApiHelperTracer->getStack(); //var_dump($report); $this->assertCount(4, $report); } public function testNoDebug() { DI()->debug = false; $tracer = new PhalApi_Helper_Tracer(); $tracer->mark('aHa~'); $report = $tracer->getStack(); $this->assertCount(0, $report); } public function testSql() { $this->phalApiHelperTracer->sql('SELECT'); $this->phalApiHelperTracer->sql('DELETE'); $this->assertCount(2, $this->phalApiHelperTracer->getSqls()); } } function doSthForTrace($tracer) { $tracer->mark('IN_FUNCTION'); }