diff --git a/tests/phpunit/wpmatomo/db/test-wordpress.php b/tests/phpunit/wpmatomo/db/test-wordpress.php index 59fd812b8..a6e708e87 100644 --- a/tests/phpunit/wpmatomo/db/test-wordpress.php +++ b/tests/phpunit/wpmatomo/db/test-wordpress.php @@ -272,7 +272,26 @@ public function test_update_sets_null_values_correctly_when_all_params_are_null( } public function test_query_recognizes_mariadb_set_for_queries() { - throw new \Exception( 'unimplemented' ); + \Piwik\Config::getInstance()->database['schema'] = 'Mariadb'; + \Piwik\Db\Schema::unsetInstance(); + + $params = new \Piwik\ArchiveProcessor\Parameters( + new \Piwik\Site( 1 ), + \Piwik\Period\Factory::build( 'day', 'today' ), + new \Piwik\Segment( '', [ 1 ] ) + ); + $log_aggregator = new \Piwik\DataAccess\LogAggregator( $params ); + + $sql = $log_aggregator->getQueryByDimensionSql( [], false, [], false, false, false, 120, false ); + + // make sure SQL we're testing has MariaDB specific SQL + $this->assertStringContainsString( 'SET STATEMENT max_statement_time', $sql['sql'] ); + + // test that the query works in MWP + $statement = $log_aggregator->queryVisitsByDimension( [], false, [], false, false, false, 120, false ); + $row = $statement->fetch(); + + $this->assertIsArray( $row ); } private function insert_many_values() {