https://github.com/themeplate/tester
Common for all packages
https://github.com/themeplate/tester
wordpress wordpress-development wordpress-tests
Last synced: 4 months ago
JSON representation
Common for all packages
- Host: GitHub
- URL: https://github.com/themeplate/tester
- Owner: ThemePlate
- License: gpl-3.0
- Created: 2022-05-15T09:36:50.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T14:09:33.000Z (about 1 year ago)
- Last Synced: 2025-06-13T01:46:58.292Z (about 1 year ago)
- Topics: wordpress, wordpress-development, wordpress-tests
- Language: PHP
- Homepage:
- Size: 69.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ThemePlate Tester
#### 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
```json
{
"name": "my/package",
"require": {
"php": "^7.4|^8.2"
},
"require-dev": {
"themeplate/tester": "*"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests"
}
}
}
```
### SampleTest.php
```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
```json
...
"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"
}
...
```