{"action":"created","comment":{"url":"https://api.github.com/repos/Elgg/Elgg/pulls/comments/26153722","id":26153722,"diff_hunk":"@@ -3,25 +3,37 @@\n \n \n class ConfigTest extends \\PHPUnit_Framework_TestCase {\n+\t/**\n+\t * @var \\Elgg\\PluginHooksService\n+\t */\n+\tprotected $hooks;\n+\n+\t/**\n+\t * @var \\Elgg\\Amd\\Config\n+\t */\n+\tprotected $amdConfig;\n+\t\n+\tfunction setUp() {\n+\t\t$this->hooks = new \\Elgg\\PluginHooksService();\n+\t\t$amdConfig = new \\Elgg\\Amd\\Config($this->hooks);","path":"engine/tests/phpunit/Elgg/Amd/ConfigTest.php","position":16,"original_position":16,"commit_id":"64d5babdecf806c7bdd55794b8928e3a3d44be69","original_commit_id":"64d5babdecf806c7bdd55794b8928e3a3d44be69","user":{"login":"ewinslow","id":356564,"avatar_url":"https://avatars.githubusercontent.com/u/356564?v=3","gravatar_id":"","url":"https://api.github.com/users/ewinslow","html_url":"https://github.com/ewinslow","followers_url":"https://api.github.com/users/ewinslow/followers","following_url":"https://api.github.com/users/ewinslow/following{/other_user}","gists_url":"https://api.github.com/users/ewinslow/gists{/gist_id}","starred_url":"https://api.github.com/users/ewinslow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewinslow/subscriptions","organizations_url":"https://api.github.com/users/ewinslow/orgs","repos_url":"https://api.github.com/users/ewinslow/repos","events_url":"https://api.github.com/users/ewinslow/events{/privacy}","received_events_url":"https://api.github.com/users/ewinslow/received_events","type":"User","site_admin":false},"body":"I would discourage this refactoring. I know it feels like reducing duplication but it is much harder to reason about tests when you can't see the entire setup within the test method.\r\n\r\nInstead, I might recommend a createAmdConfig method that returns the config instance instead of saving it to a property of the  testcase.\r\n\r\nI also suspect this is broken (`$amdConfig` probably was meant to be `$this->amdConfig`)","created_at":"2015-03-10T18:55:31Z","updated_at":"2015-03-10T18:55:31Z","html_url":"https://github.com/Elgg/Elgg/pull/7885#discussion_r26153722","pull_request_url":"https://api.github.com/repos/Elgg/Elgg/pulls/7885","_links":{"self":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/comments/26153722"},"html":{"href":"https://github.com/Elgg/Elgg/pull/7885#discussion_r26153722"},"pull_request":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7885"}}},"pull_request":{"url":"https://api.github.com/repos/Elgg/Elgg/pulls/7885","id":28916939,"html_url":"https://github.com/Elgg/Elgg/pull/7885","diff_url":"https://github.com/Elgg/Elgg/pull/7885.diff","patch_url":"https://github.com/Elgg/Elgg/pull/7885.patch","issue_url":"https://api.github.com/repos/Elgg/Elgg/issues/7885","number":7885,"state":"open","locked":false,"title":"Amd config hook","user":{"login":"jdalsem","id":861833,"avatar_url":"https://avatars.githubusercontent.com/u/861833?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalsem","html_url":"https://github.com/jdalsem","followers_url":"https://api.github.com/users/jdalsem/followers","following_url":"https://api.github.com/users/jdalsem/following{/other_user}","gists_url":"https://api.github.com/users/jdalsem/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalsem/subscriptions","organizations_url":"https://api.github.com/users/jdalsem/orgs","repos_url":"https://api.github.com/users/jdalsem/repos","events_url":"https://api.github.com/users/jdalsem/events{/privacy}","received_events_url":"https://api.github.com/users/jdalsem/received_events","type":"User","site_admin":false},"body":"TODOs:\r\n - [x] Add a unit test that asserts the plugin hook is triggered as expected\r\n - [x] Inject the hooks service in the constructor instead of using global state","created_at":"2015-02-09T12:36:49Z","updated_at":"2015-03-10T18:55:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d84d3c66a280ebb77256210e07995926ac05efe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Elgg/Elgg/pulls/7885/commits","review_comments_url":"https://api.github.com/repos/Elgg/Elgg/pulls/7885/comments","review_comment_url":"https://api.github.com/repos/Elgg/Elgg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Elgg/Elgg/issues/7885/comments","statuses_url":"https://api.github.com/repos/Elgg/Elgg/statuses/64d5babdecf806c7bdd55794b8928e3a3d44be69","head":{"label":"jdalsem:amd-config-hook","ref":"amd-config-hook","sha":"64d5babdecf806c7bdd55794b8928e3a3d44be69","user":{"login":"jdalsem","id":861833,"avatar_url":"https://avatars.githubusercontent.com/u/861833?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalsem","html_url":"https://github.com/jdalsem","followers_url":"https://api.github.com/users/jdalsem/followers","following_url":"https://api.github.com/users/jdalsem/following{/other_user}","gists_url":"https://api.github.com/users/jdalsem/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalsem/subscriptions","organizations_url":"https://api.github.com/users/jdalsem/orgs","repos_url":"https://api.github.com/users/jdalsem/repos","events_url":"https://api.github.com/users/jdalsem/events{/privacy}","received_events_url":"https://api.github.com/users/jdalsem/received_events","type":"User","site_admin":false},"repo":{"id":3067967,"name":"Elgg","full_name":"jdalsem/Elgg","owner":{"login":"jdalsem","id":861833,"avatar_url":"https://avatars.githubusercontent.com/u/861833?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalsem","html_url":"https://github.com/jdalsem","followers_url":"https://api.github.com/users/jdalsem/followers","following_url":"https://api.github.com/users/jdalsem/following{/other_user}","gists_url":"https://api.github.com/users/jdalsem/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalsem/subscriptions","organizations_url":"https://api.github.com/users/jdalsem/orgs","repos_url":"https://api.github.com/users/jdalsem/repos","events_url":"https://api.github.com/users/jdalsem/events{/privacy}","received_events_url":"https://api.github.com/users/jdalsem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdalsem/Elgg","description":"A social networking engine","fork":true,"url":"https://api.github.com/repos/jdalsem/Elgg","forks_url":"https://api.github.com/repos/jdalsem/Elgg/forks","keys_url":"https://api.github.com/repos/jdalsem/Elgg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdalsem/Elgg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdalsem/Elgg/teams","hooks_url":"https://api.github.com/repos/jdalsem/Elgg/hooks","issue_events_url":"https://api.github.com/repos/jdalsem/Elgg/issues/events{/number}","events_url":"https://api.github.com/repos/jdalsem/Elgg/events","assignees_url":"https://api.github.com/repos/jdalsem/Elgg/assignees{/user}","branches_url":"https://api.github.com/repos/jdalsem/Elgg/branches{/branch}","tags_url":"https://api.github.com/repos/jdalsem/Elgg/tags","blobs_url":"https://api.github.com/repos/jdalsem/Elgg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdalsem/Elgg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdalsem/Elgg/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdalsem/Elgg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdalsem/Elgg/statuses/{sha}","languages_url":"https://api.github.com/repos/jdalsem/Elgg/languages","stargazers_url":"https://api.github.com/repos/jdalsem/Elgg/stargazers","contributors_url":"https://api.github.com/repos/jdalsem/Elgg/contributors","subscribers_url":"https://api.github.com/repos/jdalsem/Elgg/subscribers","subscription_url":"https://api.github.com/repos/jdalsem/Elgg/subscription","commits_url":"https://api.github.com/repos/jdalsem/Elgg/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdalsem/Elgg/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdalsem/Elgg/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdalsem/Elgg/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdalsem/Elgg/contents/{+path}","compare_url":"https://api.github.com/repos/jdalsem/Elgg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdalsem/Elgg/merges","archive_url":"https://api.github.com/repos/jdalsem/Elgg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdalsem/Elgg/downloads","issues_url":"https://api.github.com/repos/jdalsem/Elgg/issues{/number}","pulls_url":"https://api.github.com/repos/jdalsem/Elgg/pulls{/number}","milestones_url":"https://api.github.com/repos/jdalsem/Elgg/milestones{/number}","notifications_url":"https://api.github.com/repos/jdalsem/Elgg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdalsem/Elgg/labels{/name}","releases_url":"https://api.github.com/repos/jdalsem/Elgg/releases{/id}","created_at":"2011-12-29T09:43:57Z","updated_at":"2014-06-24T10:31:40Z","pushed_at":"2015-03-10T12:12:53Z","git_url":"git://github.com/jdalsem/Elgg.git","ssh_url":"git@github.com:jdalsem/Elgg.git","clone_url":"https://github.com/jdalsem/Elgg.git","svn_url":"https://github.com/jdalsem/Elgg","homepage":"http://elgg.org","size":39429,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"Elgg:1.x","ref":"1.x","sha":"306fe6cf0e05b1343d52abdcdc582677d887facf","user":{"login":"Elgg","id":79167,"avatar_url":"https://avatars.githubusercontent.com/u/79167?v=3","gravatar_id":"","url":"https://api.github.com/users/Elgg","html_url":"https://github.com/Elgg","followers_url":"https://api.github.com/users/Elgg/followers","following_url":"https://api.github.com/users/Elgg/following{/other_user}","gists_url":"https://api.github.com/users/Elgg/gists{/gist_id}","starred_url":"https://api.github.com/users/Elgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elgg/subscriptions","organizations_url":"https://api.github.com/users/Elgg/orgs","repos_url":"https://api.github.com/users/Elgg/repos","events_url":"https://api.github.com/users/Elgg/events{/privacy}","received_events_url":"https://api.github.com/users/Elgg/received_events","type":"Organization","site_admin":false},"repo":{"id":299271,"name":"Elgg","full_name":"Elgg/Elgg","owner":{"login":"Elgg","id":79167,"avatar_url":"https://avatars.githubusercontent.com/u/79167?v=3","gravatar_id":"","url":"https://api.github.com/users/Elgg","html_url":"https://github.com/Elgg","followers_url":"https://api.github.com/users/Elgg/followers","following_url":"https://api.github.com/users/Elgg/following{/other_user}","gists_url":"https://api.github.com/users/Elgg/gists{/gist_id}","starred_url":"https://api.github.com/users/Elgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elgg/subscriptions","organizations_url":"https://api.github.com/users/Elgg/orgs","repos_url":"https://api.github.com/users/Elgg/repos","events_url":"https://api.github.com/users/Elgg/events{/privacy}","received_events_url":"https://api.github.com/users/Elgg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Elgg/Elgg","description":"A social networking engine","fork":false,"url":"https://api.github.com/repos/Elgg/Elgg","forks_url":"https://api.github.com/repos/Elgg/Elgg/forks","keys_url":"https://api.github.com/repos/Elgg/Elgg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Elgg/Elgg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Elgg/Elgg/teams","hooks_url":"https://api.github.com/repos/Elgg/Elgg/hooks","issue_events_url":"https://api.github.com/repos/Elgg/Elgg/issues/events{/number}","events_url":"https://api.github.com/repos/Elgg/Elgg/events","assignees_url":"https://api.github.com/repos/Elgg/Elgg/assignees{/user}","branches_url":"https://api.github.com/repos/Elgg/Elgg/branches{/branch}","tags_url":"https://api.github.com/repos/Elgg/Elgg/tags","blobs_url":"https://api.github.com/repos/Elgg/Elgg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Elgg/Elgg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Elgg/Elgg/git/refs{/sha}","trees_url":"https://api.github.com/repos/Elgg/Elgg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Elgg/Elgg/statuses/{sha}","languages_url":"https://api.github.com/repos/Elgg/Elgg/languages","stargazers_url":"https://api.github.com/repos/Elgg/Elgg/stargazers","contributors_url":"https://api.github.com/repos/Elgg/Elgg/contributors","subscribers_url":"https://api.github.com/repos/Elgg/Elgg/subscribers","subscription_url":"https://api.github.com/repos/Elgg/Elgg/subscription","commits_url":"https://api.github.com/repos/Elgg/Elgg/commits{/sha}","git_commits_url":"https://api.github.com/repos/Elgg/Elgg/git/commits{/sha}","comments_url":"https://api.github.com/repos/Elgg/Elgg/comments{/number}","issue_comment_url":"https://api.github.com/repos/Elgg/Elgg/issues/comments{/number}","contents_url":"https://api.github.com/repos/Elgg/Elgg/contents/{+path}","compare_url":"https://api.github.com/repos/Elgg/Elgg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Elgg/Elgg/merges","archive_url":"https://api.github.com/repos/Elgg/Elgg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Elgg/Elgg/downloads","issues_url":"https://api.github.com/repos/Elgg/Elgg/issues{/number}","pulls_url":"https://api.github.com/repos/Elgg/Elgg/pulls{/number}","milestones_url":"https://api.github.com/repos/Elgg/Elgg/milestones{/number}","notifications_url":"https://api.github.com/repos/Elgg/Elgg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Elgg/Elgg/labels{/name}","releases_url":"https://api.github.com/repos/Elgg/Elgg/releases{/id}","created_at":"2009-09-06T17:10:11Z","updated_at":"2015-03-09T19:05:54Z","pushed_at":"2015-03-10T10:16:47Z","git_url":"git://github.com/Elgg/Elgg.git","ssh_url":"git@github.com:Elgg/Elgg.git","clone_url":"https://github.com/Elgg/Elgg.git","svn_url":"https://github.com/Elgg/Elgg","homepage":"http://elgg.org","size":74421,"stargazers_count":683,"watchers_count":683,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":419,"mirror_url":null,"open_issues_count":740,"forks":419,"open_issues":740,"watchers":683,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7885"},"html":{"href":"https://github.com/Elgg/Elgg/pull/7885"},"issue":{"href":"https://api.github.com/repos/Elgg/Elgg/issues/7885"},"comments":{"href":"https://api.github.com/repos/Elgg/Elgg/issues/7885/comments"},"review_comments":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7885/comments"},"review_comment":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7885/commits"},"statuses":{"href":"https://api.github.com/repos/Elgg/Elgg/statuses/64d5babdecf806c7bdd55794b8928e3a3d44be69"}}}}