summaryrefslogtreecommitdiffstats
path: root/tests/Utils/MiscTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Utils/MiscTest.php')
-rw-r--r--tests/Utils/MiscTest.php135
1 files changed, 68 insertions, 67 deletions
diff --git a/tests/Utils/MiscTest.php b/tests/Utils/MiscTest.php
index 3abc1cb..480d687 100644
--- a/tests/Utils/MiscTest.php
+++ b/tests/Utils/MiscTest.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
namespace PhpMyAdmin\SqlParser\Tests\Utils;
@@ -9,10 +10,10 @@ use PhpMyAdmin\SqlParser\Utils\Misc;
class MiscTest extends TestCase
{
/**
- * @dataProvider getAliasesProvider
- *
* @param mixed $query
* @param mixed $db
+ *
+ * @dataProvider getAliasesProvider
*/
public function testGetAliases($query, $db, array $expected)
{
@@ -24,104 +25,104 @@ class MiscTest extends TestCase
public function getAliasesProvider()
{
- return array(
- array(
+ return [
+ [
'select * from (select 1) tbl',
'mydb',
- array(),
- ),
- array(
+ [],
+ ],
+ [
'select i.name as `n`,abcdef gh from qwerty i',
'mydb',
- array(
- 'mydb' => array(
+ [
+ 'mydb' => [
'alias' => null,
- 'tables' => array(
- 'qwerty' => array(
+ 'tables' => [
+ 'qwerty' => [
'alias' => 'i',
- 'columns' => array(
+ 'columns' => [
'name' => 'n',
'abcdef' => 'gh',
- ),
- ),
- ),
- ),
- ),
- ),
- array(
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
'select film_id id,title from film',
'sakila',
- array(
- 'sakila' => array(
+ [
+ 'sakila' => [
'alias' => null,
- 'tables' => array(
- 'film' => array(
+ 'tables' => [
+ 'film' => [
'alias' => null,
- 'columns' => array(
+ 'columns' => [
'film_id' => 'id',
- ),
- ),
- ),
- ),
- ),
- ),
- array(
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
'select `sakila`.`A`.`actor_id` as aid,`F`.`film_id` `fid`,'
. 'last_update updated from `sakila`.actor A join `film_actor` as '
. '`F` on F.actor_id = A.`actor_id`',
'sakila',
- array(
- 'sakila' => array(
+ [
+ 'sakila' => [
'alias' => null,
- 'tables' => array(
- 'film_actor' => array(
+ 'tables' => [
+ 'film_actor' => [
'alias' => 'F',
- 'columns' => array(
+ 'columns' => [
'film_id' => 'fid',
'last_update' => 'updated',
- ),
- ),
- 'actor' => array(
+ ],
+ ],
+ 'actor' => [
'alias' => 'A',
- 'columns' => array(
+ 'columns' => [
'actor_id' => 'aid',
'last_update' => 'updated',
- ),
- ),
- ),
- ),
- ),
- ),
- array(
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
'SELECT film_id FROM (SELECT * FROM film) as f;',
'sakila',
- array(),
- ),
- array(
+ [],
+ ],
+ [
'',
null,
- array(),
- ),
- array(
+ [],
+ ],
+ [
'SELECT 1',
null,
- array(),
- ),
- array(
+ [],
+ ],
+ [
'SELECT * FROM orders AS ord WHERE 1',
'db',
- array(
- 'db' => array(
+ [
+ 'db' => [
'alias' => null,
- 'tables' => array(
- 'orders' => array(
+ 'tables' => [
+ 'orders' => [
'alias' => 'ord',
- 'columns' => array(),
- ),
- ),
- ),
- ),
- )
- );
+ 'columns' => [],
+ ],
+ ],
+ ],
+ ],
+ ],
+ ];
}
}