This repository has been archived by the owner. It is now read-only.
Docker tools to easily create and run tests for the PHP-SRC
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
phpt
src
test
.gitignore
LICENSE
README.md
_config.yml
circle.yml
phpqa

README.md

NOT MAINTANED ANYMORE

The development of docker-phpqa was dropped in favor of phptt which is actively maintained. Thanks to everyone that contributed with this small tool. =)

docker-phpqa

Codacy Badge CircleCI

Docker tools to easily create and run tests for PHP-SRC. The intent of this library is to help anyone to create PHPT tests for PHP language engine and its core extensions.

How to get it?

  1. You must have the latest version of docker installed on your machine.

  2. Run our installer:

curl -s https://raw.githubusercontent.com/herdphp/docker-phpqa/master/bin/installer.sh | bash
  1. Start PHPTesting!!!

How to use it?

To generate new PHPT test files

The generate-phpt tool wrapped by docker-phpqa is a developer tool that lives inside of PHP-SRC repository. It is meant to bootstrap PHPT creation, it has a very simple usage.

Usage:
phpqa generate [PHPT_DIR] -f <function_name> |-c <class_name> -m <method_name> -b|e|v [-s skipif:ini:clean:done] [-k win|notwin|64b|not64b] [-x ext]

Where:
-f function_name ................. Name of PHP function, eg cos
-c class name .................... Name of class, eg DOMDocument
-m method name ................... Name of method, eg createAttribute
-b ............................... Generate basic tests
-e ............................... Generate error tests
-v ............................... Generate variation tests
-s sections....................... Create optional sections, colon separated list
-k skipif key..................... Skipif option, only used if -s skipif is used.
-x extension...................... Skipif option, specify extension to check for
-h ............................... Print this message

If you want to see the help you can just use:

phpqa generate -h

If you want to create a basic PHPT test for the ucfirst function:

phpqa generate -f ucfirst -b

This will create a template PHPT file for the function ucfirst inside of your PHPT default folder. If you want to choose the PHPT directory where the files are generated you can pass it as the first argument of the generate command:

phpqa generate /path/to/phpt/dir -f ucfirst -b

To run your created tests against multiple PHP versions

  1. Write a PHPT test in any folder;
  2. Run the phpqa command passing as arguments the filepath (relative or full) and the PHP version to run the test (master, 72, 71, 70, 56, 55, all):
# without a version the test will run against the latest PHP stable version (PHP 7.1) codebase
phpqa run phpt/examples/closure_061.phpt
# with a version the test will run against the specified version
phpqa run phpt/examples/closure_061.phpt 56
# if you want you can pass `all` as second argument and the test will run against all available versions
phpqa run phpt/examples/closure_061.phpt all

To generate the coverage report

# without a version the coverage report will be generated for the latest PHP stable version (PHP 7.1) codebase
phpqa gcov
# with a version the coverage report will be generated for the specified version
phpqa gcov 70

Stay updated for bug fixes and new features

To update your docker-phpqa tool and images just call the update command:

phpqa update

Usage help

docker-phpqa has a small set of commands and a quick way to get help about its usage is either type the phpqa command without any arguments or calling phpqa help command.

Wiki

For tutorials, cookbooks and more information about how to use phpqa please take a look at our wiki.

PHP versions available

PHP 5.5, 5.6, 7.0, 7.1, 7.2 (RC4) and the master branch from PHP-SRC repository are fully available and supported;

Contributing

If you notice any bug or typo or if you want to improve this tool, please feel free to create an issue and/or open a pull request.

PHPTestFest2017

This repository intent to facilitate participation and contribution in the PHP Test Festival. More information about it:

Credits

LICENSE

Copyright (c) 2017 Bruno Ricardo Siqueira, Joao Paulo Vendramini Martins

This work is licensed under the terms of the MIT license.