Skip to content

Commit

Permalink
Merge pull request #24626 from demeritcowboy/assert-something
Browse files Browse the repository at this point in the history
[NFC] Assert something in unit test
  • Loading branch information
eileenmcnaughton authored Sep 27, 2022
2 parents f6963db + 556905c commit 30479e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/phpunit/api/v4/Entity/MessageTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<p>My body as HTML</p>', '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('<p>My body as HTML</p>', 'SELECT msg_html FROM civicrm_msg_template WHERE id = %1', [1 => [$saved['id'], 'Int']]);
}

}

0 comments on commit 30479e1

Please sign in to comment.