public function tearDown() { if (!extension_loaded('xhprof')) { return parent::tearDown(); } $xhprofData = xhprof_disable(); $this->endTime = microtime(true); if (defined('ARRAY_FILTER_USE_KEY')) { // ignore all phpunit related keys // var_dump($xhprofData); $xhprofData = array_filter($xhprofData, function ($key) { return !preg_match('/PHPUnit/', $key); }, ARRAY_FILTER_USE_KEY); } include_once $_ENV['XHPROF_ROOT'] . "/xhprof_lib/utils/xhprof_lib.php"; include_once $_ENV['XHPROF_ROOT'] . "/xhprof_lib/utils/xhprof_runs.php"; $namespace = 'LazyRecord:' . $this->getName(); $runs = new XHProfRuns_Default(); $runId = $runs->save_run($xhprofData, $namespace); $host = 'localhost'; if (isset($_ENV['XHPROF_HOST'])) { $host = $_ENV['XHPROF_HOST']; } echo "\n---------------------------------\n"; printf("Profile test %d times spent %.2f seconds\n", $this->N, $this->endTime - $this->startTime); printf("See profiling result at http://%s/index.php?run=%s&source=%s\n", $host, $runId, $namespace); parent::tearDown(); }
public function setUp() { parent::setUp(); $records = new ProductCollection(); $records->delete(); $records = new ProductImageCollection(); $records->delete(); }
public function setUp() { if (!extension_loaded('pdo_' . $this->driver)) { $this->markTestSkipped('pdo_' . $this->driver . ' extension is required for model testing'); return; } parent::setUp(); }
public function tearDown() { $products = new ProductCollection(); foreach ($products as $product) { $product->delete(); } parent::tearDown(); }