MailerDefaultProfileRestorationTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @since 5.0.0
  12. * @license https://opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace Cake\Test\TestCase\Mailer;
  15. use Cake\Mailer\Mailer;
  16. use Cake\TestSuite\TestCase;
  17. class MailerDefaultProfileRestorationTest extends TestCase
  18. {
  19. public function testSendAction(): void
  20. {
  21. $mailer = new class (['template' => 'cakephp']) extends Mailer {
  22. public bool $testIsCalled = false;
  23. public function test($to, $subject)
  24. {
  25. $this->testIsCalled = true;
  26. }
  27. public function deliver(string $content = ''): array
  28. {
  29. return [];
  30. }
  31. };
  32. $mailer->send('test', ['foo', 'bar']);
  33. $this->assertSame('cakephp', $mailer->viewBuilder()->getTemplate());
  34. $this->assertTrue($mailer->testIsCalled);
  35. }
  36. }