function NamedPlaceholderConverterTest::testParseReuseObject

Tests reusing the parser object.

@legacy-covers ::parse @legacy-covers ::getConvertedSQL @legacy-covers ::getConvertedParameters

File

core/modules/mysqli/tests/src/Unit/NamedPlaceholderConverterTest.php, line 389

Class

NamedPlaceholderConverterTest
Tests \Drupal\mysqli\Driver\Database\mysqli\NamedPlaceholderConverter.

Namespace

Drupal\Tests\mysqli\Unit

Code

public function testParseReuseObject() : void {
  $converter = new NamedPlaceholderConverter();
  $converter->parse('SELECT ?', [
    'foo',
  ]);
  $this->assertSame('SELECT ?', $converter->getConvertedSQL());
  $this->assertSame([
    'foo',
  ], $converter->getConvertedParameters());
  $this->expectException(\RuntimeException::class);
  $this->expectExceptionMessage('Missing Positional Parameter 0');
  $converter->parse('SELECT ?', []);
}

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