Download the PHP package scriptfusion/phpunit-immediate-exception-printer without Composer

On this page you can find all versions of the php package scriptfusion/phpunit-immediate-exception-printer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpunit-immediate-exception-printer

[![Latest version][Version image]][Releases] [![Total downloads][Downloads image]][Downloads] [![Build status][Build image]][Build] [![Test coverage][Coverage image]][Coverage]

PHPUnit Immediate Printer

Pip is a PHPUnit extension that immediately prints exceptions and assertion failures during a test run. Normally PHPUnit keeps failure details secret until the end of the test run, but sometimes we don't want to wait that long. With Pip, all secrets are immediately revealed, with a few extra benefits, too.

Benefits

Preview

The following preview is somewhat atypical but shows all supported output cases at once. Of course, we expect all your tests to be mostly green!

Pip makes no attempt to modify the test summary; only runtime output is changed.

Usage

  1. Add the dependency to your Composer file's require-dev section.

  2. Declare the printer extension in your phpunit.xml configuration file.

  3. Run the tests!

  4. Enjoy immediate test execution feedback.

Configuration

Pip's behaviour can be customized by adding <parameter> nodes as children of the <bootstrap> node in phpunit.xml, with name and value attributes corresponding to the table below.

Parameter name Default value Description
perf.slow 200 (ms) Sets the performance threshold for slow (yellow) tests.
perf.vslow 1000 (ms) Sets the performance threshold for very slow (red) tests.
test.dp.args true True to show the arguments passed by the data provider, false to hide.
test.name.strip '' Strips the specified matching portion of the test name.

Requirements

Pip version PHPUnit versions Minimum PHP version
3 10 / 11 8.1 / 8.2
2 yanked -
1 5 / 6 5.6 / 7.0

Testing Pip

To run the full test suite, use the following command.

Pip's capabilities are exploited via CapabilitiesTest. However, this test file isn't run directly because many of these tests are designed to fail. Instead, we write tests that run PHPUnit internally, each of which invokes one of the capability test cases and verifies its output. To run CapabilitiesTest, specify the following command

The real tests, also known as functional tests, are located in test/functional, written in PHPT format. PHPT is a scarcely documented format designed to support testing PHP itself. An undocumented feature of PHPUnit is its limited support for a subset of the PHPT test specification, which we exploit to test PHPUnit itself with our printer implementation loaded.

Writing functional tests

To test the output of a particular capability we run CapabilitiesTest with the --filter option to target a specific test case. Each functional test contains the arguments passed to PHPUnit in the --ARGS-- section of the file. These arguments can be pasted directly after the PHPUnit command to see the resulting output from that test case. We verify the output in the --EXPECTF-- section of the file.

One challenge we must overcome is verifying coloured output including ANSI escape sequences. To see these escape sequences we can pipe the output of a specific capability test to cat -v as shown in the following example.

The output from cat will print the "escape" character as ^[. We must replace each occurrence of this character sequence with the literal escape character (ASCII character 27). The easiest way to obtain the real escape character is to just copy it from an existing functional test.

Create a new functional test by copying an existing test as a template, then modify the PHPUnit arguments and the expected output to match what we expect using the techniques just described. Don't forget to give the test a clear description in the --TEST-- section!

Inspiration

Thanks to the following open source projects that inspired this project.


All versions of phpunit-immediate-exception-printer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
phpunit/phpunit Version ^10.5.28|^11.2.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package scriptfusion/phpunit-immediate-exception-printer contains the following files

Loading the files please wait ....