public function testStartEnd() { HeydayXhprof::start('Start'); $this->assertEquals('Start', HeydayXhprof::getAppName()); $this->assertTrue(HeydayXhprof::isStarted()); HeydayXhprof::end(); $this->assertFalse(HeydayXhprof::isStarted()); $app = DataObject::get_one('HeydayXhprofApp', "Name = 'Start'"); $this->assertTrue($app instanceof HeydayXhprofApp); $this->assertEquals($app->safeName(), 'start'); $runs = $app->Runs(); $this->assertTrue($runs instanceof DataObjectSet); $this->assertTrue($runs->First() instanceof HeydayXhprofRun); HeydayXhprof::start('New Start Something'); HeydayXhprof::end(); $app = DataObject::get_one('HeydayXhprofApp', "Name = 'New Start Something'"); $this->assertTrue($app instanceof HeydayXhprofApp); $this->assertEquals($app->safeName(), 'new-start-something'); $apps = DataObject::get('HeydayXhprofApp'); $this->assertEquals(count($apps), 2); }
<?php require_once __DIR__ . '/../HeydayXhprof.php'; if (HeydayXhprof::isAllowed(isset($_GET['url']) ? $_GET['url'] : $_SERVER['SCRIPT_FILENAME'])) { HeydayXhprof::start('Global'); }