Failed Conditions
Pull Request — develop (#3131)
by Michael
12:37
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
11
class DriverRequiredTest extends TestCase
12
{
13
    public function testDriverRequiredWithUrl() : void
14
    {
15
        $url = 'mysql://localhost';
16
        $exception = DriverRequired::new($url);
17
18
        self::assertInstanceOf(DBALException::class, $exception);
19
        self::assertSame(
20
            sprintf(
21
                "The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " .
22
                'is given to DriverManager::getConnection(). Given URL: %s',
23
                $url
24
            ),
25
            $exception->getMessage()
26
        );
27
    }
28
}
29