Skip to content

Repository files navigation

ThemePlate Tester

Available commands:

NameDescription
analyseAnalyse the codes
dumpDump the configs
fixFix the codes
lintLint the codes
setupSetup the tests
testRun 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

namespaceTests;
useThemePlate\Tester\Utils;
class SampleTest extends WP_UnitTestCase {
publicfunctiontest_sample() {
$instance = newClass();
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"
}
...

About

Common for all packages

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages