{"action":"opened","number":26696,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/26696","id":178032480,"html_url":"https://github.com/symfony/symfony/pull/26696","diff_url":"https://github.com/symfony/symfony/pull/26696.diff","patch_url":"https://github.com/symfony/symfony/pull/26696.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/26696","number":26696,"state":"open","locked":false,"title":"[VarDumper][PhpUnitBridge] VarDumperServerListener","user":{"login":"ogizanagi","id":2211145,"avatar_url":"https://avatars0.githubusercontent.com/u/2211145?v=4","gravatar_id":"","url":"https://api.github.com/users/ogizanagi","html_url":"https://github.com/ogizanagi","followers_url":"https://api.github.com/users/ogizanagi/followers","following_url":"https://api.github.com/users/ogizanagi/following{/other_user}","gists_url":"https://api.github.com/users/ogizanagi/gists{/gist_id}","starred_url":"https://api.github.com/users/ogizanagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogizanagi/subscriptions","organizations_url":"https://api.github.com/users/ogizanagi/orgs","repos_url":"https://api.github.com/users/ogizanagi/repos","events_url":"https://api.github.com/users/ogizanagi/events{/privacy}","received_events_url":"https://api.github.com/users/ogizanagi/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | master <!-- see below -->\r\n| Bug fix?      | no\r\n| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->\r\n| BC breaks?    | no     <!-- see https://symfony.com/bc -->\r\n| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->\r\n| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->\r\n| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->\r\n| License       | MIT\r\n| Doc PR        | N/A\r\n\r\nBased on previous PR (https://github.com/symfony/symfony/pull/26695) about easy server dumper as main handler registration.\r\n\r\nKeeping exploring different usages for the server dumper feature, this provides a PhpUnit listener you can configure to automatically register the server dumper (allowing to get better context about dumps, cli & html format & avoid mixing the test suite output with wild cli dumps).\r\n\r\n<details>\r\n\r\n<summary>Considering the following changes in the symfony-demo</summary>\r\n\r\n```diff\r\ndiff --git a/phpunit.xml.dist b/phpunit.xml.dist\r\nindex d545bf4..90e9a18 100644\r\n--- a/phpunit.xml.dist\r\n+++ b/phpunit.xml.dist\r\n@@ -34,5 +34,6 @@\r\n         <!-- it begins a database transaction before every testcase and rolls it back after\r\n              the test finished, so tests can manipulate the database without affecting other tests -->\r\n         <listener class=\"\\DAMA\\DoctrineTestBundle\\PHPUnit\\PHPUnitListener\" />\r\n+        <listener class=\"\\Symfony\\Bridge\\PhpUnit\\VarDumperServerListener\" />\r\n     </listeners>\r\n </phpunit>\r\ndiff --git a/src/Controller/BlogController.php b/src/Controller/BlogController.php\r\nindex e3e30aa..e2f4633 100644\r\n--- a/src/Controller/BlogController.php\r\n+++ b/src/Controller/BlogController.php\r\n@@ -50,6 +50,7 @@ class BlogController extends AbstractController\r\n      */\r\n     public function index(int $page, string $_format, PostRepository $posts): Response\r\n     {\r\n+        dump(__METHOD__);\r\n         $latestPosts = $posts->findLatest($page);\r\n\r\n         // Every template name also has two extensions that specify the format and\r\ndiff --git a/tests/Controller/BlogControllerTest.php b/tests/Controller/BlogControllerTest.php\r\nindex 822cd43..04d5e1c 100644\r\n--- a/tests/Controller/BlogControllerTest.php\r\n+++ b/tests/Controller/BlogControllerTest.php\r\n@@ -28,14 +28,19 @@ class BlogControllerTest extends WebTestCase\r\n {\r\n     public function testIndex()\r\n     {\r\n+        dump('Start '.__METHOD__);\r\n         $client = static::createClient();\r\n         $crawler = $client->request('GET', '/en/blog/');\r\n\r\n+        dump('After request '.__METHOD__);\r\n+\r\n         $this->assertCount(\r\n             Post::NUM_ITEMS,\r\n             $crawler->filter('article.post'),\r\n             'The homepage displays the right number of posts.'\r\n         );\r\n+\r\n+        dump('End '.__METHOD__);\r\n     }\r\n\r\n     public function testRss()\r\n```\r\n\r\n</details>\r\n\r\nrunning `vendor/bin/simple-phpunit --filter=BlogControllerTest::testIndex` and with server up will generate:\r\n\r\n|CLI|HTML|\r\n|--|--|\r\n|![capture d ecran 2018-03-28 a 14 50 39](https://user-images.githubusercontent.com/2211145/38029918-6ed11812-3297-11e8-89f7-cc22b522b111.png)|![capture d ecran 2018-03-28 a 14 49 17](https://user-images.githubusercontent.com/2211145/38029855-462feb90-3297-11e8-928a-92cb52de796d.png)|\r\n\r\ngiving proper context about the test case in dedicated output instead of this mess:\r\n\r\n```sh\r\nPHPUnit 6.5.7 by Sebastian Bergmann and contributors.\r\n\r\nTesting Project Test Suite\r\n\"Start App\\Tests\\Controller\\BlogControllerTest::testIndex\"\r\n\"App\\Controller\\BlogController::index\"\r\n\"After request App\\Tests\\Controller\\BlogControllerTest::testIndex\"\r\n\"End App\\Tests\\Controller\\BlogControllerTest::testIndex\"\r\n.                                                                   1 / 1 (100%)\r\n\r\nTime: 267 ms, Memory: 24.00MB\r\n```\r\n\r\n(of course the output is quite simple here)\r\n\r\nHowever, by setting the `debug.dump_destination: ` on test env too, and by not locking the handler from the PhpUnit listener, you'll get better context about the controller's dump:\r\n\r\n![capture d ecran 2018-03-28 a 14 56 06](https://user-images.githubusercontent.com/2211145/38030245-55b7b07e-3298-11e8-8364-b34a10e1bc38.png)\r\n\r\nbut right after the request is executed, the server dumper in use still is the one registered by the `DebugBundle`, so we're now loosing the PhpUnit context.\r\nSo, right now, I don't know how to get the best of both worlds. https://github.com/ogizanagi/symfony/commit/23a80bbdbe179daa020d5ebac1d4613b19d42875 is an attempt to this, but is not bullet-proof.\r\n\r\nAny feedback welcomed.","created_at":"2018-03-28T13:07:00Z","updated_at":"2018-03-28T13:07:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/26696/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/26696/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/26696/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/3dcfe26614e51bcbb2efd9dced34a513038ebdcb","head":{"label":"ogizanagi:feature/phpunit_var_dumper_server_listener","ref":"feature/phpunit_var_dumper_server_listener","sha":"3dcfe26614e51bcbb2efd9dced34a513038ebdcb","user":{"login":"ogizanagi","id":2211145,"avatar_url":"https://avatars0.githubusercontent.com/u/2211145?v=4","gravatar_id":"","url":"https://api.github.com/users/ogizanagi","html_url":"https://github.com/ogizanagi","followers_url":"https://api.github.com/users/ogizanagi/followers","following_url":"https://api.github.com/users/ogizanagi/following{/other_user}","gists_url":"https://api.github.com/users/ogizanagi/gists{/gist_id}","starred_url":"https://api.github.com/users/ogizanagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogizanagi/subscriptions","organizations_url":"https://api.github.com/users/ogizanagi/orgs","repos_url":"https://api.github.com/users/ogizanagi/repos","events_url":"https://api.github.com/users/ogizanagi/events{/privacy}","received_events_url":"https://api.github.com/users/ogizanagi/received_events","type":"User","site_admin":false},"repo":{"id":13498527,"name":"symfony","full_name":"ogizanagi/symfony","owner":{"login":"ogizanagi","id":2211145,"avatar_url":"https://avatars0.githubusercontent.com/u/2211145?v=4","gravatar_id":"","url":"https://api.github.com/users/ogizanagi","html_url":"https://github.com/ogizanagi","followers_url":"https://api.github.com/users/ogizanagi/followers","following_url":"https://api.github.com/users/ogizanagi/following{/other_user}","gists_url":"https://api.github.com/users/ogizanagi/gists{/gist_id}","starred_url":"https://api.github.com/users/ogizanagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogizanagi/subscriptions","organizations_url":"https://api.github.com/users/ogizanagi/orgs","repos_url":"https://api.github.com/users/ogizanagi/repos","events_url":"https://api.github.com/users/ogizanagi/events{/privacy}","received_events_url":"https://api.github.com/users/ogizanagi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ogizanagi/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/ogizanagi/symfony","forks_url":"https://api.github.com/repos/ogizanagi/symfony/forks","keys_url":"https://api.github.com/repos/ogizanagi/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ogizanagi/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ogizanagi/symfony/teams","hooks_url":"https://api.github.com/repos/ogizanagi/symfony/hooks","issue_events_url":"https://api.github.com/repos/ogizanagi/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/ogizanagi/symfony/events","assignees_url":"https://api.github.com/repos/ogizanagi/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/ogizanagi/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/ogizanagi/symfony/tags","blobs_url":"https://api.github.com/repos/ogizanagi/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ogizanagi/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ogizanagi/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/ogizanagi/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ogizanagi/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/ogizanagi/symfony/languages","stargazers_url":"https://api.github.com/repos/ogizanagi/symfony/stargazers","contributors_url":"https://api.github.com/repos/ogizanagi/symfony/contributors","subscribers_url":"https://api.github.com/repos/ogizanagi/symfony/subscribers","subscription_url":"https://api.github.com/repos/ogizanagi/symfony/subscription","commits_url":"https://api.github.com/repos/ogizanagi/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/ogizanagi/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/ogizanagi/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/ogizanagi/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/ogizanagi/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/ogizanagi/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ogizanagi/symfony/merges","archive_url":"https://api.github.com/repos/ogizanagi/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ogizanagi/symfony/downloads","issues_url":"https://api.github.com/repos/ogizanagi/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/ogizanagi/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/ogizanagi/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/ogizanagi/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ogizanagi/symfony/labels{/name}","releases_url":"https://api.github.com/repos/ogizanagi/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/ogizanagi/symfony/deployments","created_at":"2013-10-11T12:37:26Z","updated_at":"2017-10-30T19:03:35Z","pushed_at":"2018-03-28T12:23:42Z","git_url":"git://github.com/ogizanagi/symfony.git","ssh_url":"git@github.com:ogizanagi/symfony.git","clone_url":"https://github.com/ogizanagi/symfony.git","svn_url":"https://github.com/ogizanagi/symfony","homepage":"symfony.com","size":110803,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"symfony:master","ref":"master","sha":"44a6f60fdb02ab599bbd2b885dd6d585b88d755c","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars3.githubusercontent.com/u/143937?v=4","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars3.githubusercontent.com/u/143937?v=4","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/symfony/symfony/deployments","created_at":"2010-01-04T14:21:21Z","updated_at":"2018-03-28T08:57:27Z","pushed_at":"2018-03-28T13:06:12Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"https://symfony.com","size":115497,"stargazers_count":17086,"watchers_count":17086,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":6124,"mirror_url":null,"archived":false,"open_issues_count":814,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":6124,"open_issues":814,"watchers":17086,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/26696"},"html":{"href":"https://github.com/symfony/symfony/pull/26696"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/26696"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/26696/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/26696/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/26696/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/3dcfe26614e51bcbb2efd9dced34a513038ebdcb"}},"author_association":"MEMBER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":283,"deletions":5,"changed_files":9}}
{"actor":{"display_login":"ogizanagi"}}