https://github.com/elementor/eunit
Eunit is a php library to make WordPress PHPUnit less painful. Eunit is a collection of Test cases, common WordPress test helpers, and a few DB helpers to make the developer's life a little easier.
https://github.com/elementor/eunit
hosting-dev
Last synced: 3 months ago
JSON representation
Eunit is a php library to make WordPress PHPUnit less painful. Eunit is a collection of Test cases, common WordPress test helpers, and a few DB helpers to make the developer's life a little easier.
- Host: GitHub
- URL: https://github.com/elementor/eunit
- Owner: elementor
- Created: 2021-06-24T07:39:31.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-13T11:33:38.000Z (over 1 year ago)
- Last Synced: 2025-10-02T19:32:53.559Z (7 months ago)
- Topics: hosting-dev
- Language: PHP
- Homepage: https://elementor.github.io/eunit/
- Size: 95.7 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About The Project
Eunit is a php library to make WordPress PHPUnit less painful. Eunit is a collection of Test cases, common WordPress test helpers, and a few DB helpers to make the developer's life a little easier.
## Getting Started
Getting started with Eunit is simple and quick, just make sure you follow this guide.
### Installation
#### Composer
To install Eunit, via composer run the command below, and you will get the latest version
```bash
composer require --dev elementor/eunit
```
then you need to do is make sure to include composer autoloader in your PHPUnit `bootstrap.php`
```php
// Require composer dependencies.
// Pending on your vendor directory
require_once dirname( dirname( __FILE__ ) ) . '/vendor/autoload.php';
```
#### Manually
You can also install Eunit via git,
```bash
git clone https://github.com/elementor/eunit.git
```
Then you need to do is make sure to include Eunit instance in your PHPUnit bootstrap.php
```php
// Require eunit.php
// Pending on your directory structure
require_once dirname( dirname( __FILE__ ) ) . '/eunit/eunit.php';
\Eunit\Eunit::instance();
```
### Configuration
Before actually using Eunit you need to add a few environment variables to you PHPUnit runtime which can be done be editing your `phpunit.xml` in the element.
`EUNIT_TEST_CASE_NAMESPACE` should be set to the plugin main namespace
```xml
```
All that is left is to start using Eunit, head over to the [Docs to learn more](https://elementor.github.io/eunit/).