Code Monkey home page Code Monkey logo

phptt's Introduction

phptt

phptt a.k.a php test tools

Heavilly inspired on herdphp/phpqa.

What is phptt

phptt aims to follow PHP versions listed in http://gcov.php.net/ . Those PHP versions target git branches in php source code repository (https://github.com/php/php-src/branches and http://php.net/git.php) instead of released (http://www.php.net/downloads.php) or tagged ones (i.e. https://downloads.php.net/~pollita/).

phptt updates all its Docker images via a cron job which is run via Travis CI that is configured in GitHub repository. That cron job runs at least once a day automatically. This way, as long as you maintain your phptt binary updated in your machine (executing phptt update), you'll be at most one day late with latest PHP versions.

What is the differences between phptt and herdphp/phpqa?

herdphp/phpqa tries to follow PHP versions that are released or tagged versions of PHP plus master/HEAD. The issue is that there's no automatic process providing every day upgraded Docker images. Because of this you can pass a longer time unsynced with new PHP versions until a person process new Docker images and notice users.

Usage

phptt help

phptt a.k.a php test tools
GENERAL usage:
    phptt help ....................... Display this help message
    phptt update ..................... Update scripts and Docker images
GENERATING usage:
    phptt 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
TESTING usage:
    phptt test <path/to/test.phpt|suite> [<version>] ... Run tests
    phptt lcov <path/to/test.phpt|suite> [<version>] ... Run tests and generate GCOV/LCOV report

Install

curl -sL https://git.io/phptt-install | bash

# https://git.io/phptt-install points to https://raw.githubusercontent.com/PHPTestFestBrasil/phptt/master/bin/install.sh

Docker images

Docker images are available on https://github.com/phptestfestbrasil/docker-phptt

Docker Starts Docker Pulls Docker Automated build Docker Build Status


PHP Versions (linked to https://github.com/php/php-src branches)

  • PHP_HEAD:
  • PHP_7_4:
  • PHP_7_3:
  • PHP_7_2:
  • PHP_7_1:

phptt's People

Contributors

adrianovieira avatar airtonzanon avatar leonnleite avatar rogeriopradoj avatar royopa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

phptt's Issues

Problems with tests that uses "require"

We have a lot of problems with tests that uses require or include, because in PHPT the tests are running in another folder (PHP_HEAD for example).

---- EXPECTED OUTPUT
string(11) "Hello world"
---- ACTUAL OUTPUT
Warning: include(php_cli_server.inc): failed to open stream: No such file or directory in /usr/src/phpt/php_cli_server_001.php on line 2

Warning: include(): Failed opening 'php_cli_server.inc' for inclusion (include_path='.:/usr/local/lib/php') in /usr/src/phpt/php_cli_server_001.php on line 2

Fatal error: Uncaught Error: Call to undefined function php_cli_server_start() in /usr/src/phpt/php_cli_server_001.php:3
Stack trace:
#0 {main}
thrown in /usr/src/phpt/php_cli_server_001.php on line 3
---- FAILED

Maybe would be a good idea if phptt would run the test in the original folder where the phpt file is located to avoid this error.

phptt generate shows error message (skeleton for functions without optional arguments) but works

Running phptt generate -f strlen -b for exemple. The command outputs some errors:

/usr/local/bin/usr/local/bin/phptt
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///usr/src/php/scripts/dev/generate-phpt.phar/gtTestSubject.php on line 109

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///usr/src/php/scripts/dev/generate-phpt.phar/gtTestSubject.php on line 52

Warning: count(): Parameter must be an array or an object that implements Countable in phar:///usr/src/php/scripts/dev/generate-phpt.phar/gtTestSubject.php on line 150

I think the problem is the usr/src dir that doesn't exists

Permissions error when running newly created test

  1. Cloned php/php-src
  2. Installed phptt using the curl command.
  3. Changed working directory to cloned repo (php/php-src).
  4. Created new test ext/standard/tests/file/file_get_contents_folder.phpt in cloned repo.
  5. Executed from host: phptt test ext/standard/tests/file/file_get_contents_folder.phpt
[...]
Running selected tests.
TEST 1/1 [/usr/src/phpt/file_get_contents_folder.phpt]
Warning: file_put_contents(/usr/src/phpt/file_get_contents_folder.php): Failed to open stream: Permission denied in /usr/src/php/run-tests.php on line 1171
ERROR: Cannot open file '/usr/src/phpt/file_get_contents_folder.php' (save_text)
make: *** [test] Error 1
Makefile:247: recipe for target 'test' failed

Note: this is my first time using this tool, so maybe I misunderstood the workflow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.