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

DB2StatementTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
dl 0
loc 24
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 3
A testExecutionErrorsAreNotSuppressed() 0 9 1
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