Пример #1
0
 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();
 }
Пример #2
0
 public function setUp()
 {
     parent::setUp();
     $records = new ProductCollection();
     $records->delete();
     $records = new ProductImageCollection();
     $records->delete();
 }
Пример #3
0
 public function setUp()
 {
     if (!extension_loaded('pdo_' . $this->driver)) {
         $this->markTestSkipped('pdo_' . $this->driver . ' extension is required for model testing');
         return;
     }
     parent::setUp();
 }
Пример #4
0
 public function tearDown()
 {
     $products = new ProductCollection();
     foreach ($products as $product) {
         $product->delete();
     }
     parent::tearDown();
 }