From ac6cf4c180b5bd2266d1a452718802376d25063a Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Fri, 31 Aug 2018 22:11:51 +0900
Subject: [PATCH] Issue #2994955 by andypost, mondrake: Followup to #2848952 -
fix DatabaseLegacyTest::testDbMerge
---
.../KernelTests/Core/Database/DatabaseLegacyTest.php | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php b/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php
index c7c3ab5d0d83..e9d18a0ce4d5 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DatabaseLegacyTest.php
@@ -4,6 +4,7 @@
use Drupal\Core\Database\Query\Condition;
use Drupal\Core\Database\Query\Delete;
+use Drupal\Core\Database\Query\Merge;
use Drupal\Core\Database\Query\Update;
use Drupal\Core\Database\Transaction;
use Drupal\Core\Database\Database;
@@ -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
*/
public function testDbMerge() {
- $num_records_before = (int) $this->connection->select('test_people')->countQuery()->execute()->fetchField();
- $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.');
+ $this->assertInstanceOf(Merge::class, db_merge('test'));
}
/**
--
GitLab