Failed Conditions
Pull Request — develop (#3131)
by Michael
12:37
created

DriverRequiredTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 15
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testDriverRequiredWithUrl() 0 13 1
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