Files
agent-unit-testing/templates/cakephp/phpunit/BehaviorTest.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

56 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Test\TestCase\Model\Behavior;
use App\Model\Behavior\{{BEHAVIOR_NAME}}Behavior;
use Cake\ORM\Table;
use Cake\TestSuite\TestCase;
/**
* App\Model\Behavior\{{BEHAVIOR_NAME}}Behavior Test Case
*/
class {{BEHAVIOR_NAME}}BehaviorTest extends TestCase
{
/**
* Test subject
*
* @var \App\Model\Behavior\{{BEHAVIOR_NAME}}Behavior
*/
protected {{BEHAVIOR_NAME}}Behavior ${{VARIABLE_NAME}};
/**
* Table instance
*
* @var \Cake\ORM\Table
*/
protected Table $table;
/**
* setUp method
*/
protected function setUp(): void
{
parent::setUp();
$this->table = new Table(['table' => 'test_table']);
$this->{{VARIABLE_NAME}} = new {{BEHAVIOR_NAME}}Behavior($this->table);
}
/**
* tearDown method
*/
protected function tearDown(): void
{
unset($this->{{VARIABLE_NAME}}, $this->table);
parent::tearDown();
}
/**
* Test behavior initialization
*/
public function testInitialization(): void
{
$this->assertInstanceOf({{BEHAVIOR_NAME}}Behavior::class, $this->{{VARIABLE_NAME}});
}
}