Commit 60333c04 authored by Bill Schaller's avatar Bill Schaller

Add DbalPerformanceTestCase

parent c079d137
<?php
namespace Doctrine\Tests;
/**
* Class DbalPerformanceTestCase
* @package Doctrine\Tests\DBAL
* @author Bill Schaller
* @author robo
*/
class DbalPerformanceTestCase extends DbalFunctionalTestCase
{
/**
* @var integer
*/
protected $maxRunningTime = 0;
/**
* @return void
*/
protected function runTest()
{
$s = microtime(true);
parent::runTest();
$time = microtime(true) - $s;
if ($this->maxRunningTime != 0 && $time > $this->maxRunningTime) {
$this->fail(
sprintf(
'expected running time: <= %s but was: %s',
$this->maxRunningTime,
$time
)
);
}
}
/**
* @param integer $maxRunningTime
*
* @return void
*
* @throws \InvalidArgumentException
*/
public function setMaxRunningTime($maxRunningTime)
{
if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
$this->maxRunningTime = $maxRunningTime;
} else {
throw new \InvalidArgumentException;
}
}
/**
* @return integer
*/
public function getMaxRunningTime()
{
return $this->maxRunningTime;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment