function ConnectionTest::testDeprecatedFetchModes

Tests deprecated fetch modes.

@todo in drupal:11.0.0, do not remove this test but convert it to expect exceptions instead of deprecations.

@dataProvider providerDeprecatedFetchModes

@group legacy

File

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

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function testDeprecatedFetchModes(int $mode) : void {
    $this->expectDeprecation('Fetch mode %A is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use supported modes only. See https://www.drupal.org/node/3377999');
    $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.