delights/pest-plugin-helpers-auto-register

This package is abandoned and no longer maintained. No replacement package was suggested.

Register PEST helpers as a TestCase method.

0.1.0 2020-08-23 23:29 UTC

This package is auto-updated.

Last update: 2020-09-26 07:37:34 UTC


README

This is now part of the PEST core and this plugin does not provide anymore value

Register PEST helpers as a TestCase method.

CI status CI status

Getting started

Installation

This library can be installed using composer, if you don't have it already, download it.

You can run this command :

composer require delights/pest-plugin-helpers-auto-register

Usage

We do not support namespaced functions in Helpers.php. However, as of PHP8 and this rfc this will be possible.

Once, you installed it, every function in your tests/Helpers.php file will be available as a method in your test case.

If a method and a helper have the same name, the method will be called.

// tests/Helpers.php
function assertReallyEqual($a, $b) {
    $this->assertEquals($a, $b);
    $this->assertEquals($a, $b);
}

// tests/SomeTest.php

it('tests')
    ->assertReallyEqual(1, 1);

it('tests but better', function () {
    $this->assertReallyEqual(1, 1);
});