From 7fa74aaa5bb80f96f8f761356eb34dcd2317adc3 Mon Sep 17 00:00:00 2001 From: Samuel Vanhove Date: Mon, 31 May 2021 17:39:49 -0400 Subject: [PATCH] tests/phpunit/CRM/Core/CopyTest.php --- tests/phpunit/CRM/Core/CopyTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/CRM/Core/CopyTest.php b/tests/phpunit/CRM/Core/CopyTest.php index 76bff8c359..dd28d3e221 100644 --- a/tests/phpunit/CRM/Core/CopyTest.php +++ b/tests/phpunit/CRM/Core/CopyTest.php @@ -30,11 +30,15 @@ class CRM_Core_CopyTest extends CiviUnitTestCase { 'is_email_confirm', ]; + // same format for better comparison + $eventData = civicrm_api3('Event', 'getsingle', ['id' => $eventId]); + $eventCopy = civicrm_api3('Event', 'getsingle', ['id' => $eventCopy->id]); + foreach ($identicalParams as $name) { - $this->assertEquals($eventCopy->$name, $eventRes[$name]); + $this->assertEquals($eventCopy[$name], $eventData[$name], "{$name} should be equals between source and copy"); } - $this->assertEquals($eventCopy->title, 'Copy of ' . $eventRes['title']); + $this->assertEquals($eventCopy['title'], 'Copy of ' . $eventRes['title']); } @@ -135,10 +139,10 @@ class CRM_Core_CopyTest extends CiviUnitTestCase { protected function compareLocalizedCopy($source, $dest, $locParams, $identicalParams, $locSuffix) { foreach ($identicalParams as $name) { - $this->assertEquals($dest[$name], $source[$name]); + $this->assertEquals($dest[$name], $source[$name], "{$name} should be equals between source and copy"); } foreach ($locParams as $name) { - $this->assertEquals($dest[$name], $source[$name] . $locSuffix); + $this->assertEquals($dest[$name], $source[$name] . $locSuffix, "copy of {$name} is not properly localized"); } } -- 2.25.1