Select example


  public function testBuildTags($prefix, array $suffixes, array $expected$glue = ':') {
    $this->assertEquals($expected, Cache::buildTags($prefix$suffixes$glue));
  }

  /** * @covers ::keyFromQuery * @group legacy */
  public function testKeyFromQuery() {
    $this->expectDeprecation('Drupal\Core\Cache\Cache::keyFromQuery is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. https://www.drupal.org/node/3322044');
    $query = new Select(new StubConnection(new StubPDO()[]), 'dne');
    Cache::keyFromQuery($query);
  }

}
public function testDeprecationSchema() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\pgsql\Schema is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The PostgreSQL database driver has been moved to the pgsql module. See https://www.drupal.org/node/3129492');
    $schema = new Schema($this->connection);
    $this->assertInstanceOf(Schema::class$schema);
  }

  /** * @covers Drupal\Core\Database\Driver\pgsql\Select */
  public function testDeprecationSelect() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\pgsql\Select is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The PostgreSQL database driver has been moved to the pgsql module. See https://www.drupal.org/node/3129492');
    $select = new Select($this->connection, 'test');
    $this->assertInstanceOf(Select::class$select);
  }

  /** * @covers Drupal\Core\Database\Driver\pgsql\Truncate */
  public function testDeprecationTruncate() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\pgsql\Truncate is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The PostgreSQL database driver has been moved to the pgsql module. See https://www.drupal.org/node/3129492');
    $truncate = new Truncate($this->connection, 'test');
    $this->assertInstanceOf(Truncate::class$truncate);
  }

  
public function testDeprecationSchema() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\sqlite\Schema is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The SQLite database driver has been moved to the sqlite module. See https://www.drupal.org/node/3129492');
    $schema = new Schema($this->connection);
    $this->assertInstanceOf(Schema::class$schema);
  }

  /** * @covers Drupal\Core\Database\Driver\sqlite\Select */
  public function testDeprecationSelect() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\sqlite\Select is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The SQLite database driver has been moved to the sqlite module. See https://www.drupal.org/node/3129492');
    $select = new Select($this->connection, 'test');
    $this->assertInstanceOf(Select::class$select);
  }

  /** * @covers Drupal\Core\Database\Driver\sqlite\Statement */
  public function testDeprecationStatement() {
    $this->expectDeprecation('\Drupal\Core\Database\Driver\sqlite\Statement is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The SQLite database driver has been moved to the sqlite module. See https://www.drupal.org/node/3129492');
    $statement = new Statement($this->createMock(StubPDO::class)$this->connection, '', []);
    $this->assertInstanceOf(Statement::class$statement);
  }

  

  protected $query;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $mockPdo = $this->createMock(StubPDO::class);
    $connection = new StubConnection($mockPdo[]);
    $this->query = new Select($connection, 'test', NULL);
  }

  /** * Checks that invalid sort directions in ORDER BY get converted to ASC. */
  public function testInvalidDirection() {
    $this->query->orderBy('test', 'invalid direction');
    $order_bys = $this->query->getOrderBy();
    $this->assertEquals('ASC', $order_bys['test'], 'Invalid order by direction is converted to ASC.');
  }

  
Home | Imprint | This part of the site doesn't use cookies.