Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2020-03-15 22:35:27 +0300
committerGitHub <noreply@github.com>2020-03-15 22:35:27 +0300
commitc7dc542e63645f57886d49fc288b792ee60785d0 (patch)
treecc79c3f7e74281c3229bbd7417fe6d618cb854a6 /tests
parent7b053e85b5b037619dbee4fbcf3e7a9ca2bf8589 (diff)
respect max execution time limit for transitions plugin (#15652)
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Unit/DbHelperTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/PHPUnit/Unit/DbHelperTest.php b/tests/PHPUnit/Unit/DbHelperTest.php
index 80db514d57..ddce87246d 100644
--- a/tests/PHPUnit/Unit/DbHelperTest.php
+++ b/tests/PHPUnit/Unit/DbHelperTest.php
@@ -15,6 +15,7 @@ use Piwik\DbHelper;
* @package Piwik\Tests\Unit
* @group Core
* @group Core_Unit
+ * @group DbHelper
*/
class DbHelperTest extends \PHPUnit_Framework_TestCase
{
@@ -58,4 +59,23 @@ class DbHelperTest extends \PHPUnit_Framework_TestCase
),
);
}
+
+ /**
+ * @dataProvider getTestQueries
+ */
+ public function testAddMaxExecutionTimeHintToQuery($expected, $query, $timeLimit)
+ {
+ $result = DbHelper::addMaxExecutionTimeHintToQuery($query, $timeLimit);
+ $this->assertEquals($expected, $result);
+ }
+
+ public function getTestQueries()
+ {
+ return [
+ ['SELECT /*+ MAX_EXECUTION_TIME(1500) */ * FROM table', 'SELECT * FROM table', 1.5],
+ ['SELECT /*+ MAX_EXECUTION_TIME(20000) */ column FROM (SELECT * FROM table)', 'SELECT column FROM (SELECT * FROM table)', 20],
+ ['SELECT * FROM table', 'SELECT * FROM table', 0],
+ ['UPDATE table SET column = value', 'UPDATE table SET column = value', 150],
+ ];
+ }
}