Passed
Pull Request — master (#372)
by Wilmer
03:07
created

QueryHelperTest::testNormalizeSelect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Query\Helper;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Expression\Expression;
9
use Yiisoft\Db\Schema\Quoter;
10
use Yiisoft\Db\Tests\Support\Mock;
11
12
final class QueryHelperTest extends TestCase
13
{
14
    /**
15
     * @dataProvider \Yiisoft\Db\Tests\Query\Helper\QueryHelperProviders::tablesNameDataProvider
16
     */
17
    public function testCleanUpTableNames(array $tables, string $prefixDatabase, array $expected): void
0 ignored issues
show
Unused Code introduced by
The parameter $prefixDatabase is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public function testCleanUpTableNames(array $tables, /** @scrutinizer ignore-unused */ string $prefixDatabase, array $expected): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        $this->assertEquals(
20
            $expected,
21
            Mock::queryHelper()->cleanUpTableNames($tables, new Quoter('"', '"'))
22
        );
23
    }
24
25
    /**
26
     * @dataProvider \Yiisoft\Db\Tests\Query\Helper\QueryHelperProviders::filterConditionDataProvider
27
     */
28
    public function testFilterCondition(array|string $condition, array|string $expected): void
29
    {
30
        $this->assertEquals($expected, Mock::queryHelper()->filterCondition($condition));
31
    }
32
33
    /**
34
     * @dataProvider \Yiisoft\Db\Tests\Query\Helper\QueryHelperProviders::normalizeOrderByProvider
35
     */
36
    public function testNormalizeOrderBy(array|string|Expression $columns, array|string $expected): void
37
    {
38
        $this->assertEquals($expected, Mock::queryHelper()->normalizeOrderBy($columns));
39
    }
40
41
    /**
42
     * @dataProvider \Yiisoft\Db\Tests\Query\Helper\QueryHelperProviders::normalizeSelectProvider
43
     */
44
    public function testNormalizeSelect(array|string|Expression $columns, array|string $expected): void
45
    {
46
        $this->assertEquals($expected, Mock::queryHelper()->normalizeSelect($columns));
47
    }
48
}
49