function ConnectionTest::testSupportedFetchModes

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testSupportedFetchModes()
  2. 10 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::testSupportedFetchModes()

Tests supported fetch modes.

Attributes

#[DataProvider('providerSupportedFetchModes')]

File

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

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function testSupportedFetchModes(FetchAs $mode) : void {
  $stubPdo = $this->createStub(\PDO::class);
  $stubConnection = new StubConnection($stubPdo, []);
  $statement = new class ($stubConnection, $stubPdo, '') extends StatementBase {
    
    /**
     * {@inheritdoc}
     */
    public function execute($args = [], $options = []) {
      return TRUE;
    }

};
  $this->assertInstanceOf(StatementBase::class, $statement);
  $statement->setFetchMode($mode);
}

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