function ConnectionTest::testUnsupportedFetchModes

Tests unsupported fetch modes.

@dataProvider providerUnsupportedFetchModes

File

core/tests/Drupal/Tests/Core/Database/ConnectionTest.php, line 944

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function testUnsupportedFetchModes(int $mode) : void {
    $this->expectException(\AssertionError::class);
    $this->expectExceptionMessageMatches("/^Fetch mode FETCH_.* is not supported\\. Use supported modes only/");
    $mockPdo = $this->createMock(StubPDO::class);
    $mockConnection = new StubConnection($mockPdo, []);
    $statement = new StatementPrefetchIterator($mockPdo, $mockConnection, '');
    $this->assertInstanceOf(StatementPrefetchIterator::class, $statement);
    $statement->setFetchMode($mode);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.