{"id":24099790,"url":"https://github.com/aiiddqd/testeroid","last_synced_at":"2025-05-07T21:34:13.586Z","repository":{"id":193537285,"uuid":"578048878","full_name":"aiiddqd/testeroid","owner":"aiiddqd","description":"Auto tests and TDD for WordPress \u0026 WooCommerce with WP CLI","archived":false,"fork":false,"pushed_at":"2023-10-31T16:03:49.000Z","size":2770,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T14:13:39.827Z","etag":null,"topics":["pestphp","phpunit","test-automation","testing","woocommerce","wordpress"],"latest_commit_sha":null,"homepage":"https://wpcraft.ru/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aiiddqd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-14T06:06:16.000Z","updated_at":"2025-03-26T21:52:21.000Z","dependencies_parsed_at":"2023-10-29T16:30:11.796Z","dependency_job_id":"d35753ea-9cc4-48d9-8d09-a103edc40c00","html_url":"https://github.com/aiiddqd/testeroid","commit_stats":null,"previous_names":["uptimizt/testeroid","aiiddqd/testeroid"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiiddqd%2Ftesteroid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiiddqd%2Ftesteroid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiiddqd%2Ftesteroid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiiddqd%2Ftesteroid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiiddqd","download_url":"https://codeload.github.com/aiiddqd/testeroid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252957021,"owners_count":21831422,"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":["pestphp","phpunit","test-automation","testing","woocommerce","wordpress"],"created_at":"2025-01-10T15:39:55.776Z","updated_at":"2025-05-07T21:34:13.519Z","avatar_url":"https://github.com/aiiddqd.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testeroid\n\nIt is simple plugin to getting auto tests and TDD by WP CLI\n\ninspired by Laravel \u0026 https://pestphp.com/\n\ndemo https://github.com/wpcraft-ru/wooms/tree/master/tests\n\nsupport and questions https://github.com/uptimizt/testeroid/issues\n\n# why?\n\nIt doesn't always make sense to configure complex PHP Unit for simple testing\n\n| Comparison | Testeroid | PHPUnit | PestPHP |\n| --- | --- | --- | --- |\n| Time to install and config | 1 min | 1-2 weeks | 1-2 weeks |\n| Learning curve | 1 day | 1-2 months | 1-2 months |\n| modern syntax | + | - | + |\n| WP CLI support | + | - | - |\n| simple bootstrap | + | - | - |\n| universal testing for App, Plugin or Theme | + | - | - |\n\n\n# how?\n\n## installation\n- install plugin `wp plugin install https://github.com/uptimizt/testeroid/archive/main.zip --activate --force`\n- make folder `tests` in plugin, or theme, or for whole site\n- set constant `TESTEROID_TESTS_PATH` in wp-config.php to path of tests \n  - exmaple `define('TESTEROID_TESTS_PATH', __DIR__ . \"/path/to/tests/\")`\n  - via wp cli `wp config set TESTEROID_TESTS_PATH '__DIR__ . \"/path/to/tests/\"' --raw`\n\n## write tests\n\nlike PestPHP\n\n### feature test example\n```\n//file ./tests/SomeComponent.php\n\nnamespace App\\Tests\\SomeComponent;\n\nuse function Testeroid\\{test, transaction_query};\n\n\ntransaction_query('start');\n\ntest('simple test', function(){\n\n    $post_data = [\n        'post_title'    =\u003e 'test 1',\n        'post_content'  =\u003e 'test',\n        'post_status'   =\u003e 'publish',\n    ];\n\n    // Insert the post into the database\n    $post_id = wp_insert_post( $post_data );\n    $post = get_post($post_id);\n\n\n\n    if($post-\u003epost_title === 'test 1'){\n        return true;\n    } else {\n        return false;\n    }\n\n}, 1);\n\n\ntransaction_query('rollback');\n```\n\n\n### unit test example\n```\n\u003c?php\n//file ./tests/SomeComponent.php\n\nnamespace App\\Tests\\SomeComponent;\n\nuse function Testeroid\\test;\n\ntest('smoke test', function(){\n\n    $value = check(5);\n\n    if($value === 10){\n        return true;\n    } else {\n        return false;\n    }\n\n}, 1);\n\nfunction check($x){\n    return $x + 5;\n}\n```\n\n\n\n## run\n```\ncd ./path/to/wp\nwp test\n```\n\n\n# Todo\n- [x] test seeding and import test data\n- [x] improve CLI UI\n- [ ] test GitHub Actions and auto testings for PRs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiiddqd%2Ftesteroid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiiddqd%2Ftesteroid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiiddqd%2Ftesteroid/lists"}