{"id":20574731,"url":"https://github.com/macpaw/behat-http-mock-context","last_synced_at":"2025-09-03T22:37:52.879Z","repository":{"id":38173019,"uuid":"435529131","full_name":"MacPaw/behat-http-mock-context","owner":"MacPaw","description":"Behat Context Mock HTTP Response in Testing ","archived":false,"fork":false,"pushed_at":"2025-05-02T20:30:22.000Z","size":103,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-08-29T08:45:27.402Z","etag":null,"topics":["bdd-tests","behat","behat-mock-response","mock","mock-http-data"],"latest_commit_sha":null,"homepage":"https://github.com/MacPaw/BehatHttpMockContext","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/MacPaw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-06T14:31:41.000Z","updated_at":"2023-04-13T01:57:00.000Z","dependencies_parsed_at":"2024-11-16T05:36:55.336Z","dependency_job_id":"6f1eaf37-6881-4ad0-9e8b-dab6d33068db","html_url":"https://github.com/MacPaw/behat-http-mock-context","commit_stats":{"total_commits":37,"total_committers":5,"mean_commits":7.4,"dds":"0.21621621621621623","last_synced_commit":"fd8aa7911adc61b97f09f756d4ef5bee474b1abe"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/MacPaw/behat-http-mock-context","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacPaw%2Fbehat-http-mock-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacPaw%2Fbehat-http-mock-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacPaw%2Fbehat-http-mock-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacPaw%2Fbehat-http-mock-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MacPaw","download_url":"https://codeload.github.com/MacPaw/behat-http-mock-context/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacPaw%2Fbehat-http-mock-context/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273523364,"owners_count":25120861,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bdd-tests","behat","behat-mock-response","mock","mock-http-data"],"created_at":"2024-11-16T05:36:52.219Z","updated_at":"2025-09-03T22:37:52.851Z","avatar_url":"https://github.com/MacPaw.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Behat HTTP Mock Context\n=================================\n\n|  Version  | Build Status | Code Coverage |\n|:---------:|:-------------:|:-----:|\n|  `main`   | [![CI][main Build Status Image]][main Build Status] | [![Coverage Status][main Code Coverage Image]][main Code Coverage] |\n\nInstallation\n============\n\nStep 1: Download the Bundle\n----------------------------------\nOpen a command console, enter your project directory and execute:\n\n###  Applications that use Symfony Flex [in progress]\n```console\n$ composer require --dev macpaw/behat-http-mock-context\n```\n\n### Applications that don't use Symfony Flex\n\nOpen a command console, enter your project directory and execute the\nfollowing command to download the latest stable version of this bundle:\n\n```console\n$ composer require --dev macpaw/behat-http-mock-context\n```  \n\nThis command requires you to have Composer installed globally, as explained\nin the [installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\n\nThen, enable the bundle by adding it to the list of registered bundles\nin the `app/AppKernel.php` file of your project:\n\n```php\n\u003c?php\n// app/AppKernel.php\n\n// ...\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            BehatHttpMockContext\\BehatHttpMockContextBundle::class =\u003e ['test' =\u003e true],\n        );\n\n        // ...\n    }\n\n    // ...\n}\n```\n\nStep 2: Mock http client\n=============\nExample you have http client in `config/services.yaml`\n```yaml\n    oauth_http_client:\n        class: Symfony\\Contracts\\HttpClient\\HttpClientInterface\n        factory: ['Symfony\\Component\\HttpClient\\HttpClient', createForBaseUri]\n        arguments:\n            - '%env(OAUTH_URL)%'\n```\n\nNow you need mock this client in `config/services_test.yaml`\n\n```yaml\n    oauth_http_client:\n        class: ExtendedMockHttpClient\\ExtendedMockHttpClient\n        arguments:\n            - '%env(OAUTH_URL)%'\n        tags: ['mock.http_client']\n...\n```\n\nNow we ready add build mock collection \n```yaml\n    BehatHttpMockContext\\Collection\\ExtendedMockHttpClientCollection:\n        arguments:\n            - !tagged_iterator mock.http_client\n...\n```\n\nStep 3: Configure Behat\n=============\nGo to `behat.yml`\n\n```yaml\n...\n  contexts:\n    - BehatHttpMockContext\\Context\\MockContext\n...\n```\n\nStep 4: How to use:\n=============\n```\n    Given I mock \"oauth_http_client\" HTTP client next response status code should be 200 with body:\n        \"\"\"\n        {\n            \"success\": true,\n            \"response\": {\n                \"user_id\": 234\n            }\n        }\n        \"\"\"\n```\n\n[main Build Status]: https://github.com/macpaw/behat-http-mock-context/actions?query=workflow%3ACI+branch%3Amain\n[main Build Status Image]: https://github.com/macpaw/behat-http-mock-context/workflows/CI/badge.svg?branch=main\n[main Code Coverage]: https://codecov.io/gh/macpaw/behat-http-mock-context/branch/main\n[main Code Coverage Image]: https://img.shields.io/codecov/c/github/macpaw/behat-http-mock-context/main?logo=codecov\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacpaw%2Fbehat-http-mock-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacpaw%2Fbehat-http-mock-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacpaw%2Fbehat-http-mock-context/lists"}