Failed Conditions
Pull Request — develop (#3131)
by Michael
60:38
created

DriverRequiredTest::testDriverRequiredWithUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Exception;
6
7
use Doctrine\DBAL\DBALException;
8
use Doctrine\DBAL\Exception\DriverRequired;
9
use PHPUnit\Framework\TestCase;
10
use function sprintf;
11
12
class DriverRequiredTest extends TestCase
13
{
14
    public function testDriverRequiredWithUrl() : void
15
    {
16
        $url       = 'mysql://localhost';
17
        $exception = DriverRequired::new($url);
18
19
        self::assertInstanceOf(DBALException::class, $exception);
20
        self::assertSame(
21
            sprintf(
22
                "The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " .
23
                'is given to DriverManager::getConnection(). Given URL: %s',
24
                $url
25
            ),
26
            $exception->getMessage()
27
        );
28
    }
29
}
30