function ConnectionTest::testSupportedLegacyFetchModes

Tests supported fetch modes.

Attributes

#[IgnoreDeprecations] #[DataProvider('providerSupportedLegacyFetchModes')]

File

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

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function testSupportedLegacyFetchModes(int $mode) : void {
  $this->expectDeprecation("Passing the \$mode argument as an integer to setFetchMode() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use a case of \\Drupal\\Core\\Database\\Statement\\FetchAs enum instead. See https://www.drupal.org/node/3488338");
  $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.