Edit a template
public editTemplate ( integer $id, string $name = NULL, string $subject = NULL, string $htmlBody = NULL, string $textBody = NULL ) : Postmark\Models\DynamicResponseModel | ||
$id | integer | The ID of the template you wish to update. |
$name | string | The friendly name for this template. |
$subject | string | The template to be used for the 'subject' of emails sent using this template. |
$htmlBody | string | The template to be used for the 'htmlBody' of emails sent using this template. |
$textBody | string | The template to be used for the 'textBody' of emails sent using this template. |
Результат | Postmark\Models\DynamicResponseModel |
function testClientCanEditTemplate() { $tk = parent::$testKeys; $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); $result = $client->createTemplate('test-php-template-' . date('c'), "{{subject}}", "Hello <b>{{name}}</b>!", "Hello {{name}}!"); $firstVersion = $client->getTemplate($result->TemplateId); $r2 = $client->editTemplate($result->TemplateId, 'test-php-template-edited-' . date('c'), "{{subject}}!", "Hi <b>{{name}}</b>!", "Hi {{name}}!"); $secondVersion = $client->getTemplate($r2->TemplateId); $this->assertNotSame($firstVersion->Name, $secondVersion->Name); $this->assertNotSame($firstVersion->HtmlBody, $secondVersion->HtmlBody); $this->assertNotSame($firstVersion->Subject, $secondVersion->Subject); $this->assertNotSame($firstVersion->TextBody, $secondVersion->TextBody); }