function EntityQueryServiceDeprecation::testPostgresServiceDeprecated

Tests that the core provided service is deprecated.

@group legacy

File

core/modules/pgsql/tests/src/Kernel/EntityQueryServiceDeprecation.php, line 22

Class

EntityQueryServiceDeprecation
Tests the move of the 'pgsql.entity.query.sql' service.

Namespace

Drupal\Tests\pgsql\Kernel

Code

public function testPostgresServiceDeprecated() : void {
    $running_driver = $this->container
        ->get('database')
        ->driver();
    if ($running_driver === 'pgsql') {
        $this->markTestSkipped('The service is not deprecated for pgsql database driver.');
    }
    $this->expectDeprecation('The "pgsql.entity.query.sql" service is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Install the pgsql module to replace this service. See https://www.drupal.org/node/3488580');
    $this->expectDeprecation('\\Drupal\\Core\\Entity\\Query\\Sql\\pgsql\\QueryFactory is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The PostgreSQL override of the entity query has been moved to the pgsql module. See https://www.drupal.org/node/3488580');
    $service = $this->container
        ->get('pgsql.entity.query.sql');
    $this->assertInstanceOf(DeprecatedQueryFactory::class, $service);
}

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