Download the PHP package bartlett/phpunit-loggertestlistener without Composer

On this page you can find all versions of the php package bartlett/phpunit-loggertestlistener. 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-loggertestlistener

PHPUnit Test Suite listener for compatible PSR-3 logger

Latest Stable Version Minimum PHP Version

Goal is to provide a standard PHPUnit Listener that is capable to send unit test results to any PSR-3 compatible logger.

The listener implement the PHPUnit\Framework\TestListener interface, and used these log levels/events mapping.

ERROR

- `addError()`, when an error occurred
- `addFailure()`, when a failure occured

WARNING

- `addWarning()`, on warning test
- `addIncompleteTest()`, on incomplete test
- `addRiskyTest()`, on risky test
- `addSkippedTest()`, when a test was skipped

INFO

- `startTest()`, when a test started
- `endTest()`, when a test ended

NOTICE

- `startTestSuite()`, when a test suite started
- `endTestSuite()`, when a test suite ended

Installation

IMPORTANT: For demonstration purpose, a Growl Handler and an AdvancedFilter Handler were used but are not yet available as a GitHub or Packagist version.

Usage with basic PSR-3 Logger

We will use a very basic PSR-3 logger for our first steps. Suppose we have such following implementation.

Add in your phpunit.xml configuration file the Bartlett\LoggerTestListener test listener, using our basic PSR-3 logger (YourLogger).

Using default behavior of your logger

We can change name of the channel (from default YourLoggerChannel to value YourPSR3Logger) as follow :

Configure the channel name of your logger

If you want to have advanced logging strategies, I suggest you to have a look on famous Monolog PHP Library.

Usage with Monolog

Without handler (then default output will be send to STDERR), we could have such kind of configuration, with logger channel name set to YourMonologChannel.

Add some handlers, with basic logging Monolog Strategy (filter on level only).

WARNING: When we used desktop notification such as growl, or mobile notifications powered by Pushover, you probably don't want to receive all log records, but just the most important ones (errors, failures, testsuites ended).

Actually Monolog can't do this. So this is the reason of the Pull Request to add filter capability. It's now available as a standalone package. See Monolog Wiki page, and CallbackFilterHandler project's page

Now create a pre-defined logger with all handlers we wished on and the filter rules for each handlers.

And of course, declare our new listener like that :

We will get all PHPUnit log messages recorded via the StreamHandler, and only important notifications via GrowlHandler (see filter rule with callback $filter1).

Run the test suite example :

And you will get something like:

Test Suite results with Monolog Stream Handler

Test Suite results with Growl Handler

NOTE: Produced by Growl for Windows (2.0.9 and Smokestack display) with PHP GNTP library.

License

LoggerTestListener is licensed under the BSD-3 Clause License - see the LICENSE file for details


All versions of phpunit-loggertestlistener with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
psr/log Version ^1.0|^2.0|^3.0
phpunit/phpunit Version ^7.5|^8.0
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 bartlett/phpunit-loggertestlistener contains the following files

Loading the files please wait ....