在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用write-unittest
星标1
分支2
更新时间2026年5月11日 13:31
Write PHP UnitTest for WordPress Plugin.
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
Write PHP UnitTest for WordPress Plugin.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | write unittest |
| description | Write PHP UnitTest for WordPress Plugin. |
test/UnitTest.phpUse this template as sample when creating new test files. It shows all conventions applied together:
<?php
/**
* Test cases for Common trait.
*
* @package StorePress/AdminUtils/Tests
*/
declare( strict_types=1 );
use StorePress\AdminUtils\Traits\HelperMethodsTrait;
use StorePress\AdminUtils\Traits\SingletonTrait;
/**
* Common Trait Test Case.
*/
class HelperMethodsTest extends WP_UnitTestCase {
use SingletonTrait;
use HelperMethodsTrait;
private HelperMethodsTest $test_instance;
/**
* Set up test fixtures.
*/
public function set_up(): void {
parent::set_up();
$this->test_instance = self::instance();
}
/**
* Tear down test fixtures.
*/
public function tear_down(): void {
parent::tear_down();
$_GET = array();
$_POST = array();
$_REQUEST = array();
}
// =========================================================================
// Tests for get_var()
// =========================================================================
/**
* Test get_var returns variable value when set.
*/
public function test_get_var_returns_value_when_set(): void {
$variable = 'test_value';
$this->assertSame( 'test_value', $this->test_instance->get_var( $variable ) );
}
/**
* Test get_var returns default value when variable is not set.
*/
public function test_get_var_returns_default_when_not_set(): void {
$variable = null;
unset( $variable );
$this->assertSame( 'default', $this->test_instance->get_var( $variable, 'default' ) );
}
/**
* Test get_var returns null as default when no default provided.
*/
public function test_get_var_returns_null_when_no_default(): void {
$variable = null;
unset( $variable );
$this->assertNull( $this->test_instance->get_var( $variable ) );
}
}
Convert hardcoded English strings in PHP files to WordPress i18n functions. Read text domain from CLAUDE.md before starting.
Write PHP DocBlocks with PHPStan support. DO NOT modify any code — only add/update documentation.