Passed
Push — master ( a53269...1faeb7 )
by Marco
18:22
created

DB2StatementTest::setUp()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 10
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 5
nc 4
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2;
6
7
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
8
use Doctrine\Tests\DbalFunctionalTestCase;
9
use PHPUnit\Framework\Error\Notice;
10
11
class DB2StatementTest extends DbalFunctionalTestCase
12
{
13
    protected function setUp()
14
    {
15
        if ( ! extension_loaded('ibm_db2')) {
16
            $this->markTestSkipped('ibm_db2 is not installed.');
17
        }
18
19
        parent::setUp();
20
21
        if ( ! $this->_conn->getDriver() instanceof DB2Driver) {
22
            $this->markTestSkipped('ibm_db2 only test.');
23
        }
24
    }
25
26
    public function testExecutionErrorsAreNotSuppressed()
27
    {
28
        $stmt = $this->_conn->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?');
29
30
        // unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception
31
        $wrappedStmt = $stmt->getWrappedStatement();
32
33
        $this->expectException(Notice::class);
34
        $wrappedStmt->execute([[]]);
35
    }
36
}
37