{"id":19439878,"url":"https://github.com/vs0uz4/bypassforphp-snippets","last_synced_at":"2026-06-13T03:31:39.475Z","repository":{"id":67300620,"uuid":"398406898","full_name":"vs0uz4/bypassforphp-snippets","owner":"vs0uz4","description":"VS-Code Snippets for Bypass in Pest Tests","archived":false,"fork":false,"pushed_at":"2021-08-20T22:03:12.000Z","size":167,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-19T03:02:49.654Z","etag":null,"topics":["api-tests","bypass","pest","php","tests"],"latest_commit_sha":null,"homepage":"","language":null,"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/vs0uz4.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-08-20T21:45:00.000Z","updated_at":"2021-08-20T22:23:02.000Z","dependencies_parsed_at":"2023-06-10T17:15:45.627Z","dependency_job_id":null,"html_url":"https://github.com/vs0uz4/bypassforphp-snippets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vs0uz4/bypassforphp-snippets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vs0uz4%2Fbypassforphp-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vs0uz4%2Fbypassforphp-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vs0uz4%2Fbypassforphp-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vs0uz4%2Fbypassforphp-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vs0uz4","download_url":"https://codeload.github.com/vs0uz4/bypassforphp-snippets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vs0uz4%2Fbypassforphp-snippets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34271500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"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":["api-tests","bypass","pest","php","tests"],"created_at":"2024-11-10T15:27:10.871Z","updated_at":"2026-06-13T03:31:39.440Z","avatar_url":"https://github.com/vs0uz4.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bypass for PHP Snippets\n\nCode snippets for writing tests for PHP using [Bypass for PHP](https://bypassforphp.com/) in Visual Studio Code.\n\n![Screenshot](https://github.com/vs0uz4/bypassforphp-snippets/raw/main/images/screenshot.gif)\n\n## Usage\n\n### Writing Tests\n\nTo write a test, you first need to open the Bypass Server.\n\n#### Opening Server\nBypass provides two fuctions for opening server `open()` and `serve()`.\n\nType `:bopen` + [TAB] for:\n\n```php\nBypass::open();\n```\n\nType `:bserv` + [TAB] for:\n\n```php\nBypass::serve(\n    //Route::\n);\n```\n\n#### Get Base URL and/or Port\n\nType `:bburl` + [TAB] for:\n\n```php\n-\u003egetBaseUrl();\n```\n\nType `:bport` + [TAB] for:\n\n```php\n-\u003egetPort();\n```\n\n#### Stop and Shut down\n\nType `:bstop` + [TAB] for:\n\n```php\n-\u003estop();\n```\n\nType `:bdown` + [TAB] for:\n\n```php\n-\u003edown();\n```\n\n#### Adding Routes (Standard and File) \n\nBypass Server provides two types of routes: `Standard Routes` and `File Routes`. \n\nFor standard routes the bypass provides the `addRoute()` method. This method has an alias, called `expect()`.\n\nType `:baro` + [TAB] for:\n\n```php\n-\u003eaddRoute(method: '', uri: '', status: , body: );\n```\n\nType `:bexp` + [TAB] for:\n\n```php\n-\u003eexpect(method: '', uri: '', status: , body: );\n```\n\nFor File routes:\n\nType `:bafr` + [TAB] for:\n\n```php\n-\u003eaddFileRoute(method: '', uri: '', status: , file: );\n```\n\n#### Asserting Routes\n\nType `:bass` + [TAB] for:\n\n```php\n-\u003eassertRoutes();\n```\n\n### Route Helpers\n\nWhen we use the `serve()` method to open a bypass server, it expects us to pass it routes. And for this, Bypass offers us the route helpers.\n\nAfter opening the Bypass server by typing `:bserv`, finish adding the desired route.\n\nExample: Type `:brok` + [TAB] produces:\n\n```php\nBypass::serve(\n    Route::ok(method: '', uri: '', body: '', times: )\n    ..\n);\n```\n\nAvailable `Route::` methods:\n\n| Trigger         | Snippet          |\n| --------------- | ---------------- |\n| :brok           | Route::ok(method: '', uri: '', body: '', times: ) |\n| :brbadrequest   | Route::badRequest(method: '', uri: '', body: '', times: ) |\n| :brunauthorized | Route::unauthorized(method: '', uri: '', body: '$', times: ) |\n| :brforbidden    | Route::forbidden(method: '', uri: '', body: '', times: ) |\n| :brcreated      | Route::created(uri: '', body: '', times: ) |\n| :brnotfound     | Route::notFound(method: '', uri: '', body: '', times: ) |\n| :brnotallowed   | Route::notAllowed(method: '', uri: '', body: '', times: ) |\n| :brtoomany      | Route::tooMany(method: '', uri: '', body: '', times: ) |\n| :brservererror  | Route::serverError(method: '', uri: '', body: '', times: ) |\n| :brvalidationfailed | Route::validationFailed(method: '', uri: '', body: '', times: ) |\n| :brfile    | Route::file(method: '', uri: '', file: '', status: , times: ) |\n| :brget     | Route::get(uri: '', body: '', status: , times: ) |\n| :brgetfile | Route::getFile(uri: '', file: '', status: , times: ) |\n| :brpost    | Route::post(uri: '', body: '', status: , times: ) |\n| :brput     | Route::put(uri: '', body: '', status: , times: ) |\n| :brdelete  | Route::delete(uri: '', body: '', status: , times: ) |\n| :brpatch   | Route::patch(uri: '', body: '', status: , times: ) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvs0uz4%2Fbypassforphp-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvs0uz4%2Fbypassforphp-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvs0uz4%2Fbypassforphp-snippets/lists"}