themeplate / tester
Common for all packages
Installs: 350
Dependents: 29
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/themeplate/tester
Requires
- php: ^7.4|^8.2
- brain/monkey: ^2.6
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.2|^1.0
- phpcompatibility/phpcompatibility-wp: ^2.1
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.6|^2.0
- phpunit/phpunit: ^9.5|^11.0
- squizlabs/php_codesniffer: ^3.6
- symfony/process: ^5.4|^7.0
- szepeviktor/phpstan-wordpress: ^1.3|^2.0
- themeplate/cli: ^0.1.0|^1.0
- wp-coding-standards/wpcs: ^2.3|^3.0
- yoast/phpunit-polyfills: ^1.0|^2.0|^3.0|^4.0
README
Available commands:
| Name | Description |
|---|---|
| analyse | Analyse the codes |
| dump | Dump the configs |
| fix | Fix the codes |
| lint | Lint the codes |
| setup | Setup the tests |
| test | Run the tests |
Usage
composer.json
{
"name": "my/package",
"require": {
"php": "^7.4|^8.2"
},
"require-dev": {
"themeplate/tester": "*"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests"
}
}
}
SampleTest.php
namespace Tests; use ThemePlate\Tester\Utils; class SampleTest extends WP_UnitTestCase { public function test_sample() { $instance = new Class(); Utils::invoke_inaccessible_method( $instance, 'method_name', array( 'arg1', 'arg2' ) ); $value = Utils::get_inaccessible_property( $instance, 'property_name' ); Utils::set_inaccessible_property( $instance, 'wanted_property', $value ); // Do actual assertions } }
After composer install, run ./vendor/bin/themeplate setup
- Analyse
./vendor/bin/themeplate analyse - Lint
./vendor/bin/themeplate lint - Fix
./vendor/bin/themeplate fix - Test
./vendor/bin/themeplate test
Dump the configs for customizations ./vendor/bin/themeplate dump
Sample composer scripts
... "scripts": { "analyse": "themeplate analyse", "lint": "themeplate lint", "fix": "themeplate fix", "test": "themeplate test", "test:unit": "themeplate test --type unit", "test:integration": "themeplate test --type integration" } ...