Completed
Push — 2.8 ( c0195c...8d2399 )
by Sergei
21:38
created

QuotingTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stringLiteralProvider() 0 5 1
A testQuoteStringLiteral() 0 8 1
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Functional\Platform;
4
5
use Doctrine\Tests\DbalFunctionalTestCase;
6
7
class QuotingTest extends DbalFunctionalTestCase
8
{
9
    /**
10
     * @dataProvider stringLiteralProvider
11
     */
12
    public function testQuoteStringLiteral(string $string) : void
13
    {
14
        $platform = $this->_conn->getDatabasePlatform();
15
        $query    = $platform->getDummySelectSQL(
16
            $platform->quoteStringLiteral($string)
17
        );
18
19
        self::assertSame($string, $this->_conn->fetchColumn($query));
20
    }
21
22
    /**
23
     * @return mixed[][]
24
     */
25
    public static function stringLiteralProvider() : iterable
26
    {
27
        return [
28
            'backslash' => ['\\'],
29
            'single-quote' => ["'"],
30
        ];
31
    }
32
}
33