Allows the running of PHPUnit within ExpressionEngine

Overview

EE Unit Tests

EE Unit Tests is an Add-on for ExpressionEngine that allows developers to execute unit tests from the Command Line. EE Unit Tests uses PHPUnit 9 out of the box though, in theory, you should be able to use whatever version you want.

Requirements

  1. ExpressionEngine >= 6.1
  2. PHP 7.3

Installation

To get EE Unit Tests working simply:

  1. Install this Git repo
  2. Run composer install within the unit_tests directory (where the composer.json file is located.
  3. Write your tests

How It Works

EE Unit Tests is middleware between ExpressionEngine and your unit tests that you execute through ExpressionEngine's Command Line tool (introduced in 6.1).

Example Command

This will execute the Tests within the unit_tests add-on.

php ./system/eecli.php tests:run -a your_addon_name

WHY THE HELL WOULD YOU BUILD IT THIS WAY?!?!

So, previously, to run unit tests on ExpressionEngine code was cumbersome (at best). We're talking bootstraps, code runners, database instantiation, raw CodeIgniter, the list goes on. And this was PER PROJECT.

It pretty much sucked.

But, with release of 6.1, we got Command Line tools! Which handles all the rigamarole of setting all the bootstrap and environment up. So, yeah, just a silly little pass through thing here is all that's needed.

Creating Unit Tests for Add-ons

PHPUnit unit tests will be automatically detected within any tests directories stored in your add-on's root directory. For example, unit_tests/tests would be automatically picked up.

You can also configure a specific directory, relative to your add-on directory, within your addon.setup.php file, using the tests key.

Limitations

The biggest problem is that there isn't any Command Line Options Support for configuration. Too much. Not worth it. Instead, be sure to use a phpunit.xml configuration file stored within your Tests root directory.

You might also like...
PHPUnit Application Architecture Test

PHPUnit Application Architecture Test Idea: write architecture tests as well as feature and unit tests Installation Install via composer composer requ

PHPUnit to Pest Converter

PestConverter PestConverter is a PHP library for converting PHPUnit tests to Pest tests. Before use Before using this converter, make sure your files

PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust
PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust

Steward: easy and robust testing with Selenium WebDriver + PHPUnit Steward is a set of libraries made to simplify writing and running robust functiona

PHPUnit extension for database interaction testing.

This extension is no longer maintained DbUnit PHPUnit extension for database interaction testing. Installation Composer If you use Composer to manage

Mock implementation of the Translation package, for testing with PHPUnit

PoP Translation - Mock Mock implementation of the Translation package, for testing with PHPUnit Install Via Composer composer require getpop/translati

Magento PHPUnit Integration

Magento PHPUnit Integration Magento is a quite complex platform without built in unit test suite, so the code is not oriented on running tests over it

The objective of ParaTest is to support parallel testing in PHPUnit

The objective of ParaTest is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop paratest in your project and start using it with no additional bootstrap or configurations!

Report high memory usage PHPUnit tests: Managed by opg-org-infra & Terraform

phpunit-memory-usage Report high memory usage PHPUnit tests: Managed by opg-org-infra & Terraform Configuration Add into the phpunit.xml extensions se

PHPStan PHPUnit extensions and rules

PHPStan PHPUnit extensions and rules PHPStan PHPUnit This extension provides following features: createMock(), getMockForAbstractClass() and getMockFr

Releases(0.0.1)
Owner
Eric Lamb
mithra62 was founded in 2011 by Eric Lamb as an online repository for his side projects and quickly took a life of its own.
Eric Lamb
Qase-phpunit - Qase TMS PHPUnit reporter.

Qase TMS PHPUnit reporter Publish results simple and easy. How to integrate composer require qase/phpunit-reporter Example of usage The PHPUnit report

Qase TMS 6 Nov 24, 2022
Mockery - Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library

Mockery Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its c

Mockery 10.3k Jan 1, 2023
Satisfy the Type APIs for the WordPress schema when running PHPUnit tests

Satisfy the Type APIs for the WordPress schema when running PHPUnit tests

GraphQL API 1 Apr 12, 2022
The most powerful and flexible mocking framework for PHPUnit / Codeception.

AspectMock AspectMock is not an ordinary PHP mocking framework. With the power of Aspect Oriented programming and the awesome Go-AOP library, AspectMo

Codeception Testing Framework 777 Dec 12, 2022
:computer: Parallel testing for PHPUnit

ParaTest The objective of ParaTest is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop paratest in y

null 2k Dec 31, 2022
vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.

vfsStream vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with

null 1.4k Dec 23, 2022
Rector upgrades rules for PHPUnit

Rector Rules for PHPUnit See available PHPUnit rules Install composer require rector/rector-phpunit Use Sets To add a set to your config, use Rector\P

RectorPHP 34 Dec 27, 2022
Add mocking capabilities to Pest or PHPUnit

This repository contains the Pest Plugin Mock. The Mocking API can be used in regular PHPUnit projects. For that, you just have to run the following c

PEST 16 Dec 3, 2022
A sample RESTful API in Laravel with PHPunit test.

Laravel PHP Framework URL | URI | Action |

Fasil 9 Jul 11, 2020