-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/Controller/Webhook/UpdateTransactionalEmailTemplateControllerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Tests\App\Controller\Webhook; | ||
|
||
use App\Entity\Email\TransactionalEmailTemplate; | ||
use Tests\App\AbstractWebTestCase; | ||
use Tests\App\Controller\ControllerTestTrait; | ||
|
||
class UpdateTransactionalEmailTemplateControllerTest extends AbstractWebTestCase | ||
{ | ||
use ControllerTestTrait; | ||
|
||
public function testTemplateUpdateEndpoint(): void | ||
{ | ||
$this->client->jsonRequest('POST', '/templates', [ | ||
'identifier' => 'test-email-a', | ||
'subject' => 'Test will be green !', | ||
'content' => 'Hello, this is a test email', | ||
'jsonContent' => '{"blocks":[{"type":"text","data":{"text":"Hello, this is a test email"}}]}', | ||
'parent' => null, | ||
], server: ['HTTP_AUTHORIZATION' => 'Bearer abc']); | ||
|
||
$this->assertResponseIsSuccessful(); | ||
|
||
$template = $this->getRepository(TransactionalEmailTemplate::class)->findOneBy(['identifier' => 'test-email-a']); | ||
$this->assertNotNull($template); | ||
$this->assertSame('Test will be green !', $template->subject); | ||
$this->assertSame('Hello, this is a test email', $template->getContent()); | ||
$this->assertSame('{"blocks":[{"type":"text","data":{"text":"Hello, this is a test email"}}]}', $template->getJsonContent()); | ||
|
||
$this->client->jsonRequest('POST', '/templates', [ | ||
'identifier' => 'test-email-a', | ||
'subject' => 'Test will be green again !', | ||
'content' => 'Hello, juste a test email', | ||
'jsonContent' => '{"blocks":[{"type":"text","data":{"text":"Hello, this is a test email"}}]}', | ||
'parent' => null, | ||
], server: ['HTTP_AUTHORIZATION' => 'Bearer abc']); | ||
|
||
$this->assertResponseIsSuccessful(); | ||
|
||
$template = $this->getRepository(TransactionalEmailTemplate::class)->findOneBy(['identifier' => 'test-email-a']); | ||
$this->assertNotNull($template); | ||
$this->assertSame('Test will be green again !', $template->subject); | ||
$this->assertSame('Hello, juste a test email', $template->getContent()); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->client->setServerParameter('HTTP_HOST', static::getContainer()->getParameter('production_webhook_host')); | ||
} | ||
} |