payload: {"action":"created","issue":{"url":"https://api.github.com/repos/ankitpokhrel/tus-php/issues/130","repository_url":"https://api.github.com/repos/ankitpokhrel/tus-php","labels_url":"https://api.github.com/repos/ankitpokhrel/tus-php/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/ankitpokhrel/tus-php/issues/130/comments","events_url":"https://api.github.com/repos/ankitpokhrel/tus-php/issues/130/events","html_url":"https://github.com/ankitpokhrel/tus-php/pull/130","id":411533649,"node_id":"MDExOlB1bGxSZXF1ZXN0MjUzOTU5MzQy","number":130,"title":"Allow serving requests without relying on global request scope","user":{"login":"adamquaile","id":69929,"node_id":"MDQ6VXNlcjY5OTI5","avatar_url":"https://avatars2.githubusercontent.com/u/69929?v=4","gravatar_id":"","url":"https://api.github.com/users/adamquaile","html_url":"https://github.com/adamquaile","followers_url":"https://api.github.com/users/adamquaile/followers","following_url":"https://api.github.com/users/adamquaile/following{/other_user}","gists_url":"https://api.github.com/users/adamquaile/gists{/gist_id}","starred_url":"https://api.github.com/users/adamquaile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamquaile/subscriptions","organizations_url":"https://api.github.com/users/adamquaile/orgs","repos_url":"https://api.github.com/users/adamquaile/repos","events_url":"https://api.github.com/users/adamquaile/events{/privacy}","received_events_url":"https://api.github.com/users/adamquaile/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2019-02-18T15:35:27Z","updated_at":"2019-02-20T13:50:59Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/ankitpokhrel/tus-php/pulls/130","html_url":"https://github.com/ankitpokhrel/tus-php/pull/130","diff_url":"https://github.com/ankitpokhrel/tus-php/pull/130.diff","patch_url":"https://github.com/ankitpokhrel/tus-php/pull/130.patch"},"body":"I'm trying to integrate this library into our application, and in the process of writing some functional tests. \r\n\r\nSince in https://github.com/ankitpokhrel/tus-php/blob/master/src/Request.php#L19 when the `Request` is instantiated the underlying http foundation request is unset, it always relies on the global request scope using `createFromGlobals`. \r\n\r\nI need this library to serve the request that the Symfony Kernel provides rather than trying to build a second request object. \r\n\r\nThis PR allows my controller to look as follows, and for me to be able to test the whole process:\r\n\r\n```    /**\r\n     * TUS upload endpoint\r\n     *\r\n     * @Route(\"/documents/uploads/tus/\", name=\"tus_post\")\r\n     * @Route(\"/documents/uploads/tus/{token?}\", name=\"tus\", requirements={\"token\"=\".+\"})\r\n     *\r\n     */\r\n    public function server(Request $request, Server $server)\r\n    {\r\n        return $server->serve(new \\TusPhp\\Request($request));\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/ankitpokhrel/tus-php/issues/comments/465581858","html_url":"https://github.com/ankitpokhrel/tus-php/pull/130#issuecomment-465581858","issue_url":"https://api.github.com/repos/ankitpokhrel/tus-php/issues/130","id":465581858,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2NTU4MTg1OA==","user":{"login":"adamquaile","id":69929,"node_id":"MDQ6VXNlcjY5OTI5","avatar_url":"https://avatars2.githubusercontent.com/u/69929?v=4","gravatar_id":"","url":"https://api.github.com/users/adamquaile","html_url":"https://github.com/adamquaile","followers_url":"https://api.github.com/users/adamquaile/followers","following_url":"https://api.github.com/users/adamquaile/following{/other_user}","gists_url":"https://api.github.com/users/adamquaile/gists{/gist_id}","starred_url":"https://api.github.com/users/adamquaile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamquaile/subscriptions","organizations_url":"https://api.github.com/users/adamquaile/orgs","repos_url":"https://api.github.com/users/adamquaile/repos","events_url":"https://api.github.com/users/adamquaile/events{/privacy}","received_events_url":"https://api.github.com/users/adamquaile/received_events","type":"User","site_admin":false},"created_at":"2019-02-20T13:50:59Z","updated_at":"2019-02-20T13:50:59Z","author_association":"NONE","body":"Thanks for the response. \r\n\r\nIt's not that I _can't_ mock the tus-php methods, it's more about whether that should be necessary. An important distinction is the one between unit and functional tests. \r\n\r\nFrom https://phptherightway.com/#testing under \"Functional Testing\"\r\n> Sometimes also known as acceptance testing, functional testing consists of using tools to create automated tests that actually use your application instead of just verifying that individual units of code are behaving correctly and that individual units can speak to each other correctly. These tools typically work using real data and simulating actual users of the application.\r\n\r\nThis is the style of test that I'm writing. I'm choosing this over unit-testing here because you've already well unit-tested the library. I trust that it works because of the unit tests you've already written. My tests aim to cover that I've integrated tus-php correctly. \r\n\r\nIf I mocked tus-php methods during this style of test it wouldn't really achieve this purpose; it would not correctly cover the \"glue\" code integrating the library and our application. It also means we'd have to couple our tests to the internals of the library. \r\n\r\nAs it happens, I don't think I'll be using this library, doing direct to s3 uploads instead so if you're not convinced of the approach, feel free to close this PR. \r\n\r\nThanks again!"}}
other: {"actor":{"display_login":"adamquaile"}}