{"id":13519719,"url":"https://github.com/atoum/ruler-extension","last_synced_at":"2025-04-10T05:32:13.237Z","repository":{"id":26691424,"uuid":"30148324","full_name":"atoum/ruler-extension","owner":"atoum","description":" The atoum ruler-extension allows you to filter your tests using Hoa\\Ruler.","archived":false,"fork":false,"pushed_at":"2017-02-24T13:25:02.000Z","size":40,"stargazers_count":9,"open_issues_count":2,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-24T16:46:05.811Z","etag":null,"topics":["atoum","atoum-extension","php","test"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atoum.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":"2015-02-01T14:27:09.000Z","updated_at":"2022-11-20T15:15:31.000Z","dependencies_parsed_at":"2022-09-17T12:11:41.087Z","dependency_job_id":null,"html_url":"https://github.com/atoum/ruler-extension","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atoum%2Fruler-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atoum%2Fruler-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atoum%2Fruler-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atoum%2Fruler-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atoum","download_url":"https://codeload.github.com/atoum/ruler-extension/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247947859,"owners_count":21023066,"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":["atoum","atoum-extension","php","test"],"created_at":"2024-08-01T05:02:02.330Z","updated_at":"2025-04-10T05:32:12.883Z","avatar_url":"https://github.com/atoum.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# atoum/ruler-extension [![Build Status](https://travis-ci.org/atoum/ruler-extension.svg?branch=master)](https://travis-ci.org/atoum/ruler-extension)\n\nThis extension allows you to precisely filter test cases to run with a \"natural language\".\n\nThe extension adds a `--filter` option to atoum. This line now appears on the atoum help:\n\n```\n--filter: Filters tests to execute. For example 'not(\"featureA\" in tags) and namespace = \"foo\\bar\"'\n```\n\nYou can now filter your tests using any [Hoa\\Ruler filter](https://github.com/hoaproject/Ruler).\n\n\n## Example\n\n```\n./vendor/bin/atoum -d tests --filter 'not(\"featureA\" in tags) and namespace = \"foo\\bar\"'\n```\n\nThis will only launch test that are not tagged with \"featureA\" and have the `foo\\bar` namespace.\n\n\n## Available filters\n\nThose variables are available in the filter:\n\n* `method`\n* `class`\n* `namespace`\n* `testedclass`\n* `testedclassnamespace`\n* `tags` (as an array)\n* `extensions` (as an array)\n\n\n## Install it\n\nInstall extension using [composer](https://getcomposer.org):\n\n```\ncomposer require --dev atoum/ruler-extension\n```\n\nThe extension will be automatically loaded. If you ever want to unload it, you can add this to your configuration file:\n\n```php\n\u003c?php\n\n// .atoum.php\n\nuse mageekguy\\atoum\\ruler;\n\n$runner-\u003eremoveExtension(ruler\\extension::class);\n```\n\n## Examples\n\n\n### Filter on tags\n\nRun all tests who have the `needsDatabase` tag:\n\n```\n./vendor/bin/atoum -d tests --filter 'tags contains \"needsDatabase\"'\n```\n\nRun all tests except those who have the `needsDatabase` tag:\n\n```\n./vendor/bin/atoum -d tests --filter 'not (tags contains \"needsDatabase\")'\n```\n\nYou can also use the ruler's default `in` operator, but in that case that's less readable:\n\n```\n./vendor/bin/atoum -d tests --filter 'not (\"needsDatabase\" in tags)'\n```\n\nRead more about tags in [atoum's documentation](http://docs.atoum.org/en/latest/launch_test.html?highlight=tags#tags).\n\n\n### Filter on the test method name\n\nRun all tests with a method named `testMethod1`:\n\n```\n./vendor/bin/atoum -d tests --filter 'method = \"testMethod1'\n```\n\nRun all tests with a method named `testMethod1` (using an array representing a list of methods to filter):\n\n```\n./vendor/bin/atoum -d tests --filter 'method in [\"testMethod1\"]'\n```\n\n\n### Filter on the test classname\n\nRun the test with the `mageekguy\\atoum\\ruler\\tests\\units\\testClass1` classname:\n\n```\n./vendor/bin/atoum -d tests --filter 'class = \"mageekguy\\atoum\\ruler\\tests\\units\\testClass1'\n```\n\n\n### Filter on the test namespace\n\nRun all tests in the `mageekguy\\atoum\\ruler\\tests\\units` namespace:\n\n```\n./vendor/bin/atoum -d tests --filter 'namespace = \"mageekguy\\atoum\\ruler\\tests\\units'\n```\n\n\n### Filter on the tested class name\n\nRun the tests that test the `mageekguy\\atoum\\ruler\\testClass1` class:\n\n```\n./vendor/bin/atoum -d tests --filter 'testedclass = \"mageekguy\\atoum\\ruler\\testClass1'\n```\n\n\n### Filter on the tested class namespace\n\nRun the tests that test the classes in the `mageekguy\\atoum\\ruler` namespace:\n\n```\n./vendor/bin/atoum -d tests --filter 'testedclassnamespace = \"mageekguy\\atoum\\ruler'\n```\n\n\n### Filter on the test required extensions\n\nRun all tests that needs the blackfire extension :\n\n```\n./vendor/bin/atoum -d tests --filter 'extensions contains \"blackfire\"'\n```\n\nYou can also use the ruler's default `in` operator, but in that case that's less readable:\n\n```\n./vendor/bin/atoum -d tests --filter '\"blackfire\" in tags'\n```\n\nYou can read more about the test required extensions in [atoum's documentation](http://docs.atoum.org/en/latest/written_help.html#php-extensions).\n\n\n### Apply multiple filters\n\n\nYou can also define more complex filters like this: Run all tests tagged `needsDatabase` and with method `testClass1` or with a method `testClass`:\n\n```\n./vendor/bin/atoum --filter '(\"needsDatabase\" in tags and method = \"testClass1\") or (method = \"testClass\")'\n```\n\n## Links\n\n* [Hoa\\Ruler](https://github.com/hoaproject/Ruler)\n* [Hoa\\Ruler's documentation](http://hoa-project.net/En/Literature/Hack/Ruler.html)\n* [atoum](http://atoum.org)\n* [atoum's documentation](http://docs.atoum.org)\n\n## License\n\nruler-extension is released under the MIT License. See the bundled LICENSE file for details.\n\n![atoum](http://atoum.org/images/logo/atoum.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatoum%2Fruler-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatoum%2Fruler-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatoum%2Fruler-extension/lists"}