{"id":26893550,"url":"https://github.com/dazz/oauth2-server-httpfoundation-webtest","last_synced_at":"2026-03-07T21:01:58.912Z","repository":{"id":8127431,"uuid":"9544574","full_name":"dazz/oauth2-server-httpfoundation-webtest","owner":"dazz","description":"oauth2-server-httpfoundation-webtest","archived":false,"fork":false,"pushed_at":"2013-05-06T12:42:14.000Z","size":132,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-11T15:16:56.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dazz.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}},"created_at":"2013-04-19T12:00:07.000Z","updated_at":"2015-02-20T06:02:17.000Z","dependencies_parsed_at":"2022-09-07T10:41:53.375Z","dependency_job_id":null,"html_url":"https://github.com/dazz/oauth2-server-httpfoundation-webtest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dazz/oauth2-server-httpfoundation-webtest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazz%2Foauth2-server-httpfoundation-webtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazz%2Foauth2-server-httpfoundation-webtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazz%2Foauth2-server-httpfoundation-webtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazz%2Foauth2-server-httpfoundation-webtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dazz","download_url":"https://codeload.github.com/dazz/oauth2-server-httpfoundation-webtest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazz%2Foauth2-server-httpfoundation-webtest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30231489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: 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":[],"created_at":"2025-03-31T23:58:20.100Z","updated_at":"2026-03-07T21:01:58.888Z","avatar_url":"https://github.com/dazz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"oauth2-server-httpfoundation-webtest\n===================================\n\nA webtesting bridge for oauth2-server-php with [bshaffer/oauth2-server-httpfoundation-bridge](https://github.com/bshaffer/oauth2-server-httpfoundation-bridge).\n\nSilex, Symfony and other frameworks depending on symfony/http-kernel offer a WebTestCase class for testing controller/actions. In order to write webtests for actions that are secured by the bshaffer/oauth2-server-php the request instance needs to implement \\OAuth2_RequestInterface.\n\nTo achieve a valid request object the WebTestCase classes need to extend the WebTestCase class provided here.\n\n## Install\n\nadd to `composer.json`\n\n```json\n{\n  \"minimum-stability\": \"dev\",\n  \"require-dev\": {\n    \"dazz/oauth2-server-httpfoundation-webtest\":\"dev-master\"\n  }\n}\n```\n\nRun `composer.phar update --dev` to install the development dependencies.\n\n## Example for Silex\n\n```php\nnamespace Company\\Test\\SomeBundle\\Controller\n\nuse OAuth2\\HttpFoundationWebTest\\Silex\\WebTestCase;\n\nclass UserControllerTest extends WebTestCase\n{\n    public function testGetUser()\n    {\n        // create user, oauth2-client and access_token in the test-storage\n        $accessToken = 'abc';\n        // this creates the browsing client, not to mix up with the oauth2-client\n        $client = $this-\u003ecreateClient();\n\n        $client-\u003erequest('GET', '/user/', array('access_token' =\u003e $accessToken));\n\n        $this-\u003eassertTrue($client-\u003egetResponse()-\u003eisSuccessful());\n    }\n\n    public function testProjects()\n    {\n        $accessToken = 'abc';\n        $client = $this-\u003ecreateClient();\n\n        $content = json_encode(array(\n            'name' =\u003e 'My Project',\n        ));\n\n        // the content of $server['HTTP_AUTHORIZATION'] will be copied to the header\n        $server = array(\n            'HTTP_AUTHORIZATION'=\u003e sprintf('Bearer %s', $accessToken),\n        );\n\n        $client-\u003erequest('PUT', '/projects/theId', array(), array(), $server, $content);\n\n        // all sorts of assertions on response string\n        $this-\u003eassertTrue($client-\u003egetResponse()-\u003eisSuccessful());\n    }\n}\n```\n\n## Links\n\n* [oauth2-server-httpfoundation-bridge](https://github.com/bshaffer/oauth2-server-httpfoundation-bridge)\n* [oauth2-server-php](https://github.com/bshaffer/oauth2-server-php)\n* [Silex](http://silex.sensiolabs.org/doc/testing.html)\n* [Symfony](http://symfony.com/doc/current/book/testing.html#your-first-functional-test)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdazz%2Foauth2-server-httpfoundation-webtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdazz%2Foauth2-server-httpfoundation-webtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdazz%2Foauth2-server-httpfoundation-webtest/lists"}