diff --git a/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php b/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php index 391ca1a9bd..becc74e001 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php @@ -437,6 +437,15 @@ public function testDbOptionsTarget() { $this->assertNotNull($this->connection->query('SELECT * FROM {test}', [], ['target' => 'bar'])); } + /** + * Tests deprecation of the $options 'target' key in Select. + * + * @expectedDeprecation Passing a 'target' key to \Drupal\Core\Database\Connection::query $options argument is deprecated in Drupal 8.0.x and will be removed before Drupal 9.0.0. Instead, use \Drupal\Core\Database\Database::getConnection($target)->query(). See https://www.drupal.org/node/2993033. + */ + public function testDbOptionsTargetInSelect() { + $this->assertNotNull($this->connection->select('test', 't', ['target' => 'bar'])->fields('t')->execute()); + } + /** * Tests deprecation of the db_query_temporary() function. *