Download the PHP package oscmarb/phpunit-speedgun without Composer

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

phpunit-speedgun

SpeedGun detects slow tests executed with PHPUnit and displays them in the console.

The execution times of tests can vary for various reasons, such as system load, disk access, etc. This tool can identify tests that are considered slow but may not provide an explanation for why they are slow.

Screenshot of terminal using SpeedGun

Installation

SpeedGun is installed using Composer. Add it as a require-dev dependency:

composer require --dev oscmarb/phpunit-speedgun

Usage

Enable with all defaults by adding the following code to your project's phpunit.xml file:

Now run the test suite. If one or more test executions exceed the slowness threshold (100ms by default), SpeedGun will report on those tests in the console after all tests have completed.

Configuring the extension

SpeedGun supports these configuration parameters:

Each parameter is set in phpunit.xml:

Custom slowness threshold per-test case

There are some tests that, due to their implementation, are slower (or faster) than the average of the tests in our suite. For this reason, there are different ways to customize the threshold.

Annotation

The @slowThreshold annotation can set a threshold. This value can be higher or lower than the general threshold. The set threshold will only be used for the test in which we are using it.

Setting @slowThreshold 0 will never report that test as slow.

Regex expression

Another alternative is to use regular expressions to set a threshold for a set of tests. Tests are identified by class::method. For example: App\SlowTestCase::test_slow.

Suppose we have integration tests with Doctrine, and we want to increase the threshold for these tests as they are slower than the unit tests. We can go test by test and update the threshold using annotations.

This process is slow, and furthermore, we could end up with tests lacking the correct annotation. If we know that all tests with Doctrine contain the word Doctrine, we can configure a different threshold as follows:

Disable slowness profiling using an environment variable

SpeedGun profiles for slow tests when enabled in phpunit.xml. But using an environment variable named PHPUNIT_SPEED_GUN can enable or disable the extension:

PHPUNIT_SPEED_GUN="0" ./vendor/bin/phpunit****

or

PHPUNIT_SPEED_GUN="disabled" ./vendor/bin/phpunit****

The value of the environment variable can also be set in the phpunit.xml file:

Setup

Requirements

Instructions

Follow the steps below to set up the environment that allows you to modify and test SpeedGun:

Makefile file contains all available commands.

PHP Version Support Policy

This package supports PHP versions with active support.

The maintainers of this package add support for a PHP version following its initial release and drop support for a PHP version when it has reached its end of active support.

License

phpunit-speedgun is available under the MIT License.

Credits

This package is inspired by johnkary/phpunit-speedtrap, originally licensed under MIT by John Kary

Social

Follow @oscmarb on Twitter.


All versions of phpunit-speedgun with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
phpunit/phpunit Version ^8.0 || ^9.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 oscmarb/phpunit-speedgun contains the following files

Loading the files please wait ....