snicco/better-wp-cli-testing

Provides test utilities for snicco/better-wp-cli

v2.0.0-beta.9 2024-09-07 14:27 UTC

README

This package provides a CommandTester class that allows testing CLI-commands created with snicco/better-wp-cli without having to run the entire wp runner from end-to-end.

Installation

composer require snicco/better-wp-cli-testing

Usage

use Snicco\Component\BetterWPCLI\Testing\CommandTester;

$tester = new CommandTester(new CreateUserCommand());

$tester->run(['calvin', 'calvin@snicco.io'], ['send-email' => true]);

$tester->assertCommandIsSuccessful();

$tester->assertStatusCode(0);

$tester->seeInStdout('User created!');

$tester->dontSeeInStderr('Fail');

Contributing

This repository is a read-only split of the development repo of the Snicco project.

This is how you can contribute.

Reporting issues and sending pull requests

Please report issues in the Snicco monorepo.

Security

If you discover a security vulnerability, please follow our disclosure procedure.