Files
agent-unit-testing/templates/cakephp/phpunit/MailerTest.template.php
T
Pham-Tan-Thien 7425b263d5 feat: add comprehensive unit testing support for CakePHP
- Add 4 CakePHP Claude Code skills: cakephp-unit-test, cakephp-test-setup, cakephp-test-review, cakephp-mock-helper
- Add 11 CakePHP PHPUnit component templates (Table, Entity, Controller, Service, Command, Component, Middleware, Mailer, Form, Behavior, Helper)
- Add CakePHP configs (phpunit.xml.dist, app_local.test.php for SQLite in-memory)
- Add comprehensive CakePHP documentation and component guides
- Update test-runner.sh and installer to auto-detect Laravel and CakePHP
- Add CakePHP CI/CD templates for GitHub Actions and GitLab CI
- Update system prompt, verification checklist, and README with dedicated guides
2026-09-14 10:19:40 +07:00

46 lines
948 B
PHP

<?php
declare(strict_types=1);
namespace App\Test\TestCase\Mailer;
use App\Mailer\{{MAILER_NAME}}Mailer;
use Cake\TestSuite\EmailTrait;
use Cake\TestSuite\TestCase;
/**
* App\Mailer\{{MAILER_NAME}}Mailer Test Case
*/
class {{MAILER_NAME}}MailerTest extends TestCase
{
use EmailTrait;
/**
* Test subject
*
* @var \App\Mailer\{{MAILER_NAME}}Mailer
*/
protected {{MAILER_NAME}}Mailer ${{VARIABLE_NAME}};
/**
* setUp method
*/
protected function setUp(): void
{
parent::setUp();
$this->{{VARIABLE_NAME}} = new {{MAILER_NAME}}Mailer();
}
/**
* Test send welcome email
*/
public function testSendWelcomeEmail(): void
{
// Act
$this->{{VARIABLE_NAME}}->send('welcome', ['user@example.com', 'John Doe']);
// Assert
$this->assertMailSentTo('user@example.com');
$this->assertMailContainsText('John Doe');
}
}