Commit ac6cf4c1 authored by catch's avatar catch
Browse files

Issue #2994955 by andypost, mondrake: Followup to #2848952 - fix DatabaseLegacyTest::testDbMerge

parent ebdfe030
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Drupal\Core\Database\Query\Condition; use Drupal\Core\Database\Query\Condition;
use Drupal\Core\Database\Query\Delete; use Drupal\Core\Database\Query\Delete;
use Drupal\Core\Database\Query\Merge;
use Drupal\Core\Database\Query\Update; use Drupal\Core\Database\Query\Update;
use Drupal\Core\Database\Transaction; use Drupal\Core\Database\Transaction;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
...@@ -196,16 +197,7 @@ public function testDbCreateTable() { ...@@ -196,16 +197,7 @@ public function testDbCreateTable() {
* @expectedDeprecation db_merge() is deprecated in Drupal 8.0.x and will be removed before Drupal 9.0.0. Instead, get a database connection injected into your service from the container and call merge() on it. For example, $injected_database->merge($table, $options). See https://www.drupal.org/node/2993033 * @expectedDeprecation db_merge() is deprecated in Drupal 8.0.x and will be removed before Drupal 9.0.0. Instead, get a database connection injected into your service from the container and call merge() on it. For example, $injected_database->merge($table, $options). See https://www.drupal.org/node/2993033
*/ */
public function testDbMerge() { public function testDbMerge() {
$num_records_before = (int) $this->connection->select('test_people')->countQuery()->execute()->fetchField(); $this->assertInstanceOf(Merge::class, db_merge('test'));
$result = db_merge('test_people')
->key('job', 'Presenter')
->fields([
'age' => 31,
'name' => 'Tiffany',
])
->execute();
$num_records_after = (int) $this->connection->select('test_people')->countQuery()->execute()->fetchField();
$this->assertSame($num_records_before + 1, $num_records_after, 'Merge inserted properly.');
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment