{"id":15739685,"url":"https://github.com/try-php/tapping","last_synced_at":"2025-03-13T08:31:45.070Z","repository":{"id":57073105,"uuid":"107454853","full_name":"try-php/tapping","owner":"try-php","description":"Atomic testing for PHP","archived":false,"fork":false,"pushed_at":"2018-02-05T11:18:08.000Z","size":49,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T19:07:49.410Z","etag":null,"topics":["php7","test","testing","tryphp"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/try-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-18T19:42:41.000Z","updated_at":"2022-02-12T12:34:26.000Z","dependencies_parsed_at":"2022-08-24T14:54:39.706Z","dependency_job_id":null,"html_url":"https://github.com/try-php/tapping","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/try-php%2Ftapping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/try-php%2Ftapping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/try-php%2Ftapping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/try-php%2Ftapping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/try-php","download_url":"https://codeload.github.com/try-php/tapping/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243369847,"owners_count":20280089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php7","test","testing","tryphp"],"created_at":"2024-10-04T02:06:01.391Z","updated_at":"2025-03-13T08:31:44.654Z","avatar_url":"https://github.com/try-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tapping\n\u003e Atomic testing\n\n![demo](./demo.png)\n\n[![Build Status](https://travis-ci.org/try-php/tapping.svg?branch=master)](https://travis-ci.org/try-php/tapping)\n[![Technical dept](https://sonarcloud.io/api/badges/measure?key=tapping-library\u0026metric=sqale_debt_ratio)](https://sonarcloud.io/dashboard/index/tapping-library)\n\n\n## Install\n\n```bash\n$ composer require try/tapping\n```\n\n## Usage\n\n```php\n\u003c?php\nrequire_once '/path/to/autoload.php';\n\nuse function Tapping\\test;\n\ntest('some description of the test', function ($t) {\n\t// throw an Exception or exit(1) to fail a test\n});\n```\n\n## API\n\n### Functions\n\n#### `test($description, $test)`\n\nFunction to run an atomic test and output it's status.\n\n##### Arguments\n\n| Argument | Type | Description |\n|---|---|---|\n| $description | `string` | The description what the test case is supposed to do. Will be output on test run with an indication of success or failure. |\n| $test | `callable` | The test case encapsulated in an callable. The test case will be forked as a child process, so anything in the callable is encapsulated from the parent process. Needs to `exit(1)` or a thrown Exception to indicate test as failed (throwing an exception will render an error block). `exit(0)` or just nothing will mark the test as passed. |\n\n##### CLI Flags\n\nSince the runner of the tests is pure php, it is necessary for the usage in CI pipelines or other build systems that the main test process exists with an error code. Tapping has a build in feature for this.\n\nBy providing script flags on script call, e.g.\n\n```bash\n$ php test.php --build\n```\n\nThe test run will exit the whole process with `-1`, as soon as the first test fails.\n\nFlag aliases which trigger such behaviour are `--build` and `-b`.\n\nIn addition to the build flag, it is also possible to provide an `--quite` (short `-q`) flag to suppress fail information (File, Line and error that occured).\n\n#### `todo($description)`\n\nFunction to show a notation for a test case, not yet written. As reminder or note or whatever.\n\n##### Arguments\n\n| Argument | Type | Description |\n|---|---|---|\n| $description | `string` | The description of the test to be written. |\n\n### `$t`\n\nThe `$t` argument, is a container for prediction and likewise functions.\n\n#### Predictions\n\n* [predict-is](https://github.com/try-php/predict-is)\n* [predict-output](https://github.com/try-php/predict-output)\n* [predict-exception](https://github.com/try-php/predict-exception)\n\n## License\n\nGPL-2.0 © Willi Eßer, Felix Buchheim","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftry-php%2Ftapping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftry-php%2Ftapping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftry-php%2Ftapping/lists"}