driebit / booster
Make your tests run faster
Installs: 2 500
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 21
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-11-06 09:08:04 UTC
README
Introduction
Booster is a set of tools that will make your PHP and/or Symfony tests run faster and use less memory.
Installation
The recommended way to install this library is through Composer:
$ composer require driebit/booster
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Usage
Null properties on tear down
Nulling class properties on test tear down helps reduce memory footprint and test runtime. For instance when using PHPUnit:
use Driebit\Booster\Cleaner; class MyTest extends \PHPUnit_Framework_TestCase { // tests here... protected function tearDown() { // tear down actions here... $cleaner = new Cleaner(); $cleaner->nullProperties($this); } }
Or using the trait:
use Driebit\Booster\Phpunit\NullOnTearDownTrait; class MyTest extends \PHPUnit_Framework_TestCase { use NullOnTearDownTrait; }
Disable debug mode after first kernel initialization
When running functional Symfony tests, you will probably be creating the service container many times. If debug mode is enabled, Symfony will check whether any resources have changed during each container initialization. By disabling debug mode, you wil be using a cached container in your tests.
Use the trait from your AppKernel:
use Driebit\Booster\Symfony\NoDebugTrait; class AppKernel extends Kernel { use NoDebugTrait; // ... }