{"id":37015846,"url":"https://github.com/lamoda/codeception-wiremock-extension","last_synced_at":"2026-01-14T01:36:39.199Z","repository":{"id":47581018,"uuid":"216008970","full_name":"lamoda/codeception-wiremock-extension","owner":"lamoda","description":"An extension that allows to use wiremock when running codeception tests.","archived":false,"fork":true,"pushed_at":"2023-05-17T08:02:33.000Z","size":71,"stargazers_count":6,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-11T17:54:48.549Z","etag":null,"topics":["codeception","codeception-extension","codeception-module","codeception-wiremock","php","wiremock","wiremock-php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ivashkevitch/codeception-wiremock-extension","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lamoda.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-10-18T11:28:01.000Z","updated_at":"2023-02-08T14:49:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lamoda/codeception-wiremock-extension","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lamoda/codeception-wiremock-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamoda%2Fcodeception-wiremock-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamoda%2Fcodeception-wiremock-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamoda%2Fcodeception-wiremock-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamoda%2Fcodeception-wiremock-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamoda","download_url":"https://codeload.github.com/lamoda/codeception-wiremock-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamoda%2Fcodeception-wiremock-extension/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["codeception","codeception-extension","codeception-module","codeception-wiremock","php","wiremock","wiremock-php"],"created_at":"2026-01-14T01:36:38.531Z","updated_at":"2026-01-14T01:36:39.184Z","avatar_url":"https://github.com/lamoda.png","language":"PHP","readme":"# codeception-wiremock-extension\nThis Codeception Extension allows developers and testers to use WireMock to mock external services when running codeception tests.\n\ncodeception-wiremock-extension connects to an already running instance of WireMock or can also run automatically a local standalone one. And, it is able to download the version of wiremock you preffer and run it too.\nAfter the tests are finished it will close the connection and turn wiremock service off (when it started it).\n\n## See also\n\n* [WireMock PHP library](https://github.com/rowanhill/wiremock-php)\n* [Stubbing using WireMock](http://wiremock.org/stubbing.html)\n* [Verifying using WireMock](http://wiremock.org/verifying.html)\n\n## Note\n\nIf you need an application with a functionality that is similar to the one offered by WireMock and is 100% PHP, please give Phiremock a try: [Phiremock](https://github.com/mcustiel/phiremock), it also has a nice [codeception extension](https://github.com/mcustiel/phiremock-codeception-extension). \n\n## Installation\n\n### Composer:\n\nThis project is published in packagist, so you just need to add it as a dependency in your composer.json:\n\n```bash\n$ composer require lamoda/codeception-wiremock-extension\n```\n## Configuration Examples\n\n### Module\nThe module allow you to connect to a WireMock instance, it can be the one ran by the extension or an already running one.\n\n```yaml\n# acceptance.suite.yml\nmodules:\n    enabled:\n        - WireMock:\n            host: my.wiremock.host # defaults to 127.0.0.1\n            port: 80 # defaults to 8080\n```\n\n### Extension\n\n#### Default configuration \n\nThis configuration will download WireMock version 1.57 and run it on port 8080, writing logs to codeception tests _output dir.\n\n```yaml\n# codeception.yml\nextensions:\n    enabled:\n        - Codeception\\Extension\\WireMock    \n```\n\n#### Connect to a running WireMock instance\n\n```yaml\n# codeception.yml\nextensions:\n    enabled:\n        - Codeception\\Extension\\WireMock\n    config:     \n        Codeception\\Extension\\WireMock:\n            host: my.wiremock.server\n            port: 8080\n```\n\n#### Start a local WireMock instance and run it with given command line arguments\n\n```yaml\n# codeception.yml\nextensions:\n    enabled:\n        - Codeception\\Extension\\WireMock\n    config:     \n        Codeception\\Extension\\WireMock:\n            jar-path: /opt/wiremock/bin/wiremock-standalone.jar\n            port: 18080\n            https-port: 18443\n            verbose: true\n            root-dir: /opt/wiremock/root\n            \n```\n\n#### Download a WireMock instance and run it with given command line arguments\n\n```yaml\n# codeception.yml\nextensions:\n    enabled:\n        - Codeception\\Extension\\WireMock\n    config:     \n        Codeception\\Extension\\WireMock:\n            download-version: 1.57\n            port: 18080\n            https-port: 18443\n            verbose: true\n            root-dir: /opt/wiremock/root\n            logs-path: /var/log/wiremock \n```\n\n## How to use\n\n### Prepare your application\n\nFirst of all, configure your application so when it is being tested it will replace its external services with WireMock.\nFor instance, if you make some requests to a REST service located under http://your.rest.interface, replace that url in configuration with the url where WireMock runs, for instance: http://localhost:8080/rest_interface.\n\n### Write your tests\n\n```php\n// YourCest.php\nclass YourCest extends \\Codeception\\TestCase\\Test\n{\n    public function _after(\\AcceptanceTester $I)\n    {\n        $I-\u003ecleanAllPreviousRequestsToWireMock();\n    }\n\n    // tests\n    public function tryToTest(\\AcceptanceTester $I)\n    {\n        $I-\u003eexpectRequestToWireMock(\n            WireMock::get(WireMock::urlEqualTo('/some/url'))\n                -\u003ewillReturn(WireMock::aResponse()\n                -\u003ewithHeader('Content-Type', 'text/plain')\n                -\u003ewithBody('Hello world!'))\n        );\n        // Here you should execute your application in a way it requests wiremock. I do this directly to show it. \n        $response = file_get_contents('http://localhost:18080/some/url');\n        \n        $I-\u003eassertEquals('Hello world!', $response);\n        $I-\u003ereceivedRequestInWireMock(\n            WireMock::getRequestedFor(WireMock::urlEqualTo('/some/url'))\n        );\n    }\n    \n    // Also, you can access wiremock-php library directly\n    public function moreComplexTest()\n    {\n        $wiremockPhp = Codeception\\Extension\\WiremockConnection::get();\n        // Now you can use wiremock-php library\n    }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamoda%2Fcodeception-wiremock-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamoda%2Fcodeception-wiremock-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamoda%2Fcodeception-wiremock-extension/lists"}