{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/65410233","id":65410233,"diff_hunk":"@@ -0,0 +1,41 @@\n+<?php\n+\n+namespace Symfony\\Bridge\\PhpUnit;\n+\n+/**\n+ * Test that your code triggers expected error messages.\n+ *\n+ * @author Christian Flothmann <christian.flothmann@xabbuh.de>\n+ */\n+final class ErrorAssert\n+{\n+    public static function assertDeprecationsAreTriggered($expectedMessages, callable $testCode)\n+    {\n+        self::assertErrorsAreTriggered(E_USER_DEPRECATED, $expectedMessages, $testCode);\n+    }\n+\n+    public static function assertErrorsAreTriggered($expectedType, $expectedMessages, callable $testCode)\n+    {\n+        $triggeredMessages = array();\n+\n+        set_error_handler(function ($type, $message) use ($expectedType, &$triggeredMessages) {\n+            if ($expectedType !== $type) {\n+                restore_error_handler();\n+\n+                return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());\n+            }\n+\n+            $triggeredMessages[] = $message;\n+        });\n+\n+        $testCode();","path":"src/Symfony/Bridge/PhpUnit/ErrorAssert.php","position":31,"original_position":31,"commit_id":"b8fcced6cd5b6f324e85c232fbb853f514fe8ea3","original_commit_id":"b8fcced6cd5b6f324e85c232fbb853f514fe8ea3","user":{"login":"Ener-Getick","id":6871899,"avatar_url":"https://avatars.githubusercontent.com/u/6871899?v=3","gravatar_id":"","url":"https://api.github.com/users/Ener-Getick","html_url":"https://github.com/Ener-Getick","followers_url":"https://api.github.com/users/Ener-Getick/followers","following_url":"https://api.github.com/users/Ener-Getick/following{/other_user}","gists_url":"https://api.github.com/users/Ener-Getick/gists{/gist_id}","starred_url":"https://api.github.com/users/Ener-Getick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ener-Getick/subscriptions","organizations_url":"https://api.github.com/users/Ener-Getick/orgs","repos_url":"https://api.github.com/users/Ener-Getick/repos","events_url":"https://api.github.com/users/Ener-Getick/events{/privacy}","received_events_url":"https://api.github.com/users/Ener-Getick/received_events","type":"User","site_admin":false},"body":"What about putting the entire function in a try/finally structure in case an exception is thrown ?\r\n```php\r\ntry {\r\n    // ...\r\n} finally {\r\n   restore_error_handler();\r\n}","created_at":"2016-06-01T17:54:02Z","updated_at":"2016-06-01T17:54:02Z","html_url":"https://github.com/symfony/symfony/pull/18880#discussion_r65410233","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/18880","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/65410233"},"html":{"href":"https://github.com/symfony/symfony/pull/18880#discussion_r65410233"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18880"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18880","id":71468257,"html_url":"https://github.com/symfony/symfony/pull/18880","diff_url":"https://github.com/symfony/symfony/pull/18880.diff","patch_url":"https://github.com/symfony/symfony/pull/18880.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18880","number":18880,"state":"open","locked":false,"title":"[PhpUnitBridge] add a triggered errors assertion helper","user":{"login":"xabbuh","id":1957048,"avatar_url":"https://avatars.githubusercontent.com/u/1957048?v=3","gravatar_id":"","url":"https://api.github.com/users/xabbuh","html_url":"https://github.com/xabbuh","followers_url":"https://api.github.com/users/xabbuh/followers","following_url":"https://api.github.com/users/xabbuh/following{/other_user}","gists_url":"https://api.github.com/users/xabbuh/gists{/gist_id}","starred_url":"https://api.github.com/users/xabbuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabbuh/subscriptions","organizations_url":"https://api.github.com/users/xabbuh/orgs","repos_url":"https://api.github.com/users/xabbuh/repos","events_url":"https://api.github.com/users/xabbuh/events{/privacy}","received_events_url":"https://api.github.com/users/xabbuh/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | master\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets |\r\n| License       | MIT\r\n| Doc PR        | \r\n\r\nIn the past, we updated the test code several times that made sure that deprecation messages are triggered. I think we should move this code to a reusable class in the PhpUnitBridge to make it available everywhere and to be able to change a single method in case we need to update the logic.","created_at":"2016-05-25T21:44:00Z","updated_at":"2016-06-01T17:54:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df749afb0d57d1de7cda2a4cc427ee192a3722f1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/18880/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/18880/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18880/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/b8fcced6cd5b6f324e85c232fbb853f514fe8ea3","head":{"label":"xabbuh:error-assert","ref":"error-assert","sha":"b8fcced6cd5b6f324e85c232fbb853f514fe8ea3","user":{"login":"xabbuh","id":1957048,"avatar_url":"https://avatars.githubusercontent.com/u/1957048?v=3","gravatar_id":"","url":"https://api.github.com/users/xabbuh","html_url":"https://github.com/xabbuh","followers_url":"https://api.github.com/users/xabbuh/followers","following_url":"https://api.github.com/users/xabbuh/following{/other_user}","gists_url":"https://api.github.com/users/xabbuh/gists{/gist_id}","starred_url":"https://api.github.com/users/xabbuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabbuh/subscriptions","organizations_url":"https://api.github.com/users/xabbuh/orgs","repos_url":"https://api.github.com/users/xabbuh/repos","events_url":"https://api.github.com/users/xabbuh/events{/privacy}","received_events_url":"https://api.github.com/users/xabbuh/received_events","type":"User","site_admin":false},"repo":{"id":9551743,"name":"symfony","full_name":"xabbuh/symfony","owner":{"login":"xabbuh","id":1957048,"avatar_url":"https://avatars.githubusercontent.com/u/1957048?v=3","gravatar_id":"","url":"https://api.github.com/users/xabbuh","html_url":"https://github.com/xabbuh","followers_url":"https://api.github.com/users/xabbuh/followers","following_url":"https://api.github.com/users/xabbuh/following{/other_user}","gists_url":"https://api.github.com/users/xabbuh/gists{/gist_id}","starred_url":"https://api.github.com/users/xabbuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabbuh/subscriptions","organizations_url":"https://api.github.com/users/xabbuh/orgs","repos_url":"https://api.github.com/users/xabbuh/repos","events_url":"https://api.github.com/users/xabbuh/events{/privacy}","received_events_url":"https://api.github.com/users/xabbuh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xabbuh/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/xabbuh/symfony","forks_url":"https://api.github.com/repos/xabbuh/symfony/forks","keys_url":"https://api.github.com/repos/xabbuh/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xabbuh/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xabbuh/symfony/teams","hooks_url":"https://api.github.com/repos/xabbuh/symfony/hooks","issue_events_url":"https://api.github.com/repos/xabbuh/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/xabbuh/symfony/events","assignees_url":"https://api.github.com/repos/xabbuh/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/xabbuh/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/xabbuh/symfony/tags","blobs_url":"https://api.github.com/repos/xabbuh/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xabbuh/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xabbuh/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/xabbuh/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xabbuh/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/xabbuh/symfony/languages","stargazers_url":"https://api.github.com/repos/xabbuh/symfony/stargazers","contributors_url":"https://api.github.com/repos/xabbuh/symfony/contributors","subscribers_url":"https://api.github.com/repos/xabbuh/symfony/subscribers","subscription_url":"https://api.github.com/repos/xabbuh/symfony/subscription","commits_url":"https://api.github.com/repos/xabbuh/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/xabbuh/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/xabbuh/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/xabbuh/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/xabbuh/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/xabbuh/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xabbuh/symfony/merges","archive_url":"https://api.github.com/repos/xabbuh/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xabbuh/symfony/downloads","issues_url":"https://api.github.com/repos/xabbuh/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/xabbuh/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/xabbuh/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/xabbuh/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xabbuh/symfony/labels{/name}","releases_url":"https://api.github.com/repos/xabbuh/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/xabbuh/symfony/deployments","created_at":"2013-04-19T18:23:15Z","updated_at":"2014-07-05T08:26:55Z","pushed_at":"2016-06-01T07:06:56Z","git_url":"git://github.com/xabbuh/symfony.git","ssh_url":"git@github.com:xabbuh/symfony.git","clone_url":"https://github.com/xabbuh/symfony.git","svn_url":"https://github.com/xabbuh/symfony","homepage":"symfony.com","size":71610,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"symfony:master","ref":"master","sha":"93139f6f5db2d69dc373f71af8697d54554225b3","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","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://avatars.githubusercontent.com/u/143937?v=3","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":"2016-06-01T16:57:17Z","pushed_at":"2016-06-01T17:42:05Z","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":"symfony.com","size":132473,"stargazers_count":12439,"watchers_count":12439,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4866,"mirror_url":null,"open_issues_count":760,"forks":4866,"open_issues":760,"watchers":12439,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18880"},"html":{"href":"https://github.com/symfony/symfony/pull/18880"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/18880"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/18880/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18880/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18880/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/b8fcced6cd5b6f324e85c232fbb853f514fe8ea3"}}}}
{"actor":{"display_login":"Ener-Getick"}}