Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / OrmPerformanceTestCase.php
1 <?php
2
3 namespace Doctrine\Tests;
4
5 /**
6  * Description of DoctrinePerformanceTestCase
7  *
8  * @author robo
9  */
10 class OrmPerformanceTestCase extends OrmFunctionalTestCase
11 {
12     /**
13      * @var    integer
14      */
15     protected $maxRunningTime = 0;
16
17     /**
18      */
19     protected function runTest()
20     {
21         $s = microtime(true);
22         parent::runTest();
23         $time = microtime(true) - $s;
24
25         if ($this->maxRunningTime != 0 && $time > $this->maxRunningTime) {
26             $this->fail(
27               sprintf(
28                 'expected running time: <= %s but was: %s',
29
30                 $this->maxRunningTime,
31                 $time
32               )
33             );
34         }
35     }
36
37     /**
38      * @param  integer $maxRunningTime
39      * @throws InvalidArgumentException
40      * @since  Method available since Release 2.3.0
41      */
42     public function setMaxRunningTime($maxRunningTime)
43     {
44         if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
45             $this->maxRunningTime = $maxRunningTime;
46         } else {
47             throw new \InvalidArgumentException;
48         }
49     }
50
51     /**
52      * @return integer
53      * @since  Method available since Release 2.3.0
54      */
55     public function getMaxRunningTime()
56     {
57         return $this->maxRunningTime;
58     }
59 }
60