diff --git a/tests/phpunit/api/v4/Entity/MessageTemplateTest.php b/tests/phpunit/api/v4/Entity/MessageTemplateTest.php index 50ad60360615..1836a7df3073 100644 --- a/tests/phpunit/api/v4/Entity/MessageTemplateTest.php +++ b/tests/phpunit/api/v4/Entity/MessageTemplateTest.php @@ -120,14 +120,18 @@ protected function createFirstSecond() { * Test save with no id */ public function testSaveNoId() { - $saved = civicrm_api4('MessageTemplate', 'save', ['records' => [array_merge(['is_reserved' => 0], $this->baseTpl)]]); + $saved = civicrm_api4('MessageTemplate', 'save', ['records' => [array_merge(['is_reserved' => 0], $this->baseTpl)]])->first(); + $this->assertDBQuery('My Template', 'SELECT msg_title FROM civicrm_msg_template WHERE id = %1', [1 => [$saved['id'], 'Int']]); + $this->assertDBQuery('
My body as HTML
', 'SELECT msg_html FROM civicrm_msg_template WHERE id = %1', [1 => [$saved['id'], 'Int']]); } /** * Test save with an explicit null id */ public function testSaveNullId() { - $saved = civicrm_api4('MessageTemplate', 'save', ['records' => [array_merge(['id' => NULL, 'is_reserved' => 0], $this->baseTpl)]]); + $saved = civicrm_api4('MessageTemplate', 'save', ['records' => [array_merge(['id' => NULL, 'is_reserved' => 0], $this->baseTpl)]])->first(); + $this->assertDBQuery('My Template', 'SELECT msg_title FROM civicrm_msg_template WHERE id = %1', [1 => [$saved['id'], 'Int']]); + $this->assertDBQuery('My body as HTML
', 'SELECT msg_html FROM civicrm_msg_template WHERE id = %1', [1 => [$saved['id'], 'Int']]); } }