Download the PHP package tomkyle/find-run-test without Composer

On this page you can find all versions of the php package tomkyle/find-run-test. 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 find-run-test

FRT · Find and Run Test

Packagist PHP version PHP Composer

About

FRT automatically executes the associated PHPUnit test for a changed source code file.

It takes a different approach to spatie/phpunit-watcher, a mature und well-developed testing tool. Its goal is to automatically re-execute the entire PHPUnit test suite when source code files are changed. The phpunit-watcher watch command starts an own watch process which executes the full test suite once a file has changed. However, the executed tests can, however, be restricted to specific tests using the --filter option. This means that regardless of which file is changed or saved, only the specified unit tests are executed.

Compared to this package, tomkyle/find-run-test takes a different approach: After saving a file, only the PHPUnit test associated with the modified file is executed.

COMPARISON tomkyle/frt spatie/phpunit-watcher
Watch process via chokidar in package.json phpunit-watcher command
Configuration CLI options Config file and CLI options
Customization basic better
Chaining with phpstan, phpcs or rector via built-in shell && operators none
Open shells needed One Two
Tests run Those associated with changed file All or all specified tests

Installation

Install FRT with Composer:

How it works

The vendor/bin/frt executable expects the PHP file of which the source code has changed as argument. It will then look for any PHPUnit test file which suits the class name of the changed file and run the associated test. For example:

  1. You update file src/MyClass.php and pass that file as argument to FRT.

  2. FRT will look for any PHPUnit file inside the project’s tests directory.

  3. If there is a test file MyClassTest.php, FRT will execute it using PHPUnit’s --filter option.

Usage

Our goal is to automate testing as much as possible, and so do we with running unit tests. In the Node-based app developing world, Chokidar is one of the go-to file watching libraries, most often used for frontend building with webpack, gulp, workbox, and such. We will utilize it for FRT.

Install Chokidar with NPM:

Create a watch task inside the project root’s package.json, for example:

Back to our project root: Start the watch process with npm run watch. Chokidar will now report any PHP source code change and hand over the changed file to FRT, which in turn will call PHPUnit:

Assuming we just edited src/SomeNamespace/MyClass.php, we get this:

In case no associated PHPUnit test can be found, FRT will report this:

Chain with other test tools

Install the PHP development tools using Composer:

Add the PHP tools as NPM scripts to package.json – see the full example in examples/package.json

Start watching:

Development

Clone repo and install requirements

Watch source and run various tests

This will watch changes inside the src/ and tests/ directories and run a series of tests:

  1. Find and run the according unit test with PHPUnit.
  2. Find possible bugs and documentation isses using phpstan.
  3. Analyse code style and give hints on newer syntax using Rector.

Run all tests


All versions of find-run-test with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/console Version ^7.1
symfony/finder Version ^7.1
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 tomkyle/find-run-test contains the following files

Loading the files please wait ....