Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/assertwell/wp-core-test-framework
Streamline testing WordPress plugins and themes using the WordPress core test framework
https://github.com/assertwell/wp-core-test-framework
composer-package testing-tools wordpress
Last synced: 3 months ago
JSON representation
Streamline testing WordPress plugins and themes using the WordPress core test framework
- Host: GitHub
- URL: https://github.com/assertwell/wp-core-test-framework
- Owner: assertwell
- License: mit
- Created: 2020-02-26T20:10:57.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2023-02-19T17:26:01.000Z (almost 2 years ago)
- Last Synced: 2024-05-20T15:56:40.332Z (8 months ago)
- Topics: composer-package, testing-tools, wordpress
- Language: Shell
- Homepage:
- Size: 21.5 KB
- Stars: 9
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# WP Core Test Framework
[![License: MIT](https://img.shields.io/github/license/assertwell/wp-core-test-framework)](LICENSE.md)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)This package helps reduce duplication across WordPress plugins and themes by enabling common test scaffolding to be provided [via Composer](https://getcomposer.org/).
## Installation
To install the WordPress core test framework into your plugin or theme, install this package as a Composer dependency:
```sh
$ composer require --dev assertwell/wp-core-test-framework
```## Usage
### Replacing the default `bin/install-wp-tests.sh` file
When [scaffolding a new WordPress plugin or theme via WP-CLI](https://developer.wordpress.org/cli/commands/scaffold/), the generator will [create a shell script at `bin/install-wp-tests.sh`](https://github.com/wp-cli/scaffold-command/blob/master/templates/install-wp-tests.sh).
This file is meant to [create an instance of the WordPress core development repository](https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/), which includes the WordPress core testing framework.
In many cases, this shell script is never modified, and is often the only file present in the `bin/` directory. Rather than copying and pasting this file across a bunch of repositories, `install-wp-tests.sh` is provided as a vendor binary by this package.
To use it, find anywhere you're currently (or would be) referencing `bin/install-wp-tests.sh` and replace it with `vendor/bin/install-wp-tests.sh`.
```diff
# .travis.ymlinstall:
- composer install --prefer-dist --no-interaction
- - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
+ - bash vendor/bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
```If your project already contains a `bin/install-wp-tests.sh` file, you may delete it from your repository.