1. Go to this page and download the library: Download cfx/pspec library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cfx / pspec example snippets
use function Cfx\PSpec\context;
use function Cfx\PSpec\expectSubject;
use function Cfx\PSpec\get;
use function Cfx\PSpec\let;
use function Cfx\PSpec\subject;
subject(fn () => User::factory()->create(['is_admin' => get('is_admin')]));
context('when is admin', function () {
let('is_admin', fn() => true);
it('returns true', function () {
expectSubject()->is_admin->toBeTrue();
});
});
context('when is not admin', function () {
let('is_admin', fn() => false);
it('returns false', function () {
expectSubject()->is_admin->toBeFalse();
});
});
use function Cfx\PSpec\context;
use function Cfx\PSpec\get;
use function Cfx\PSpec\getSubject;
use function Cfx\PSpec\let;
subject(fn () => get('variable'));
context('when using high order testing', function () {
let('variable', fn () => 2);
it('can use high order testing')
->expect(getSubject(...))
->toEqual(2);
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.