{"action":"created","issue":{"url":"https://api.github.com/repos/piwik/piwik/issues/7931","labels_url":"https://api.github.com/repos/piwik/piwik/issues/7931/labels{/name}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/7931/comments","events_url":"https://api.github.com/repos/piwik/piwik/issues/7931/events","html_url":"https://github.com/piwik/piwik/pull/7931","id":77691346,"number":7931,"title":"Test environment and DI refactor","user":{"login":"diosmosis","id":125140,"avatar_url":"https://avatars.githubusercontent.com/u/125140?v=3","gravatar_id":"","url":"https://api.github.com/users/diosmosis","html_url":"https://github.com/diosmosis","followers_url":"https://api.github.com/users/diosmosis/followers","following_url":"https://api.github.com/users/diosmosis/following{/other_user}","gists_url":"https://api.github.com/users/diosmosis/gists{/gist_id}","starred_url":"https://api.github.com/users/diosmosis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diosmosis/subscriptions","organizations_url":"https://api.github.com/users/diosmosis/orgs","repos_url":"https://api.github.com/users/diosmosis/repos","events_url":"https://api.github.com/users/diosmosis/events{/privacy}","received_events_url":"https://api.github.com/users/diosmosis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/piwik/piwik/labels/Needs%20Review","name":"Needs Review","color":"fad8c7"},{"url":"https://api.github.com/repos/piwik/piwik/labels/Pull%20Request%20WIP","name":"Pull Request WIP","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/piwik/piwik/milestones/79","html_url":"https://github.com/piwik/piwik/milestones/2.14.0","labels_url":"https://api.github.com/repos/piwik/piwik/milestones/79/labels","id":1005076,"number":79,"title":"2.14.0","description":"","creator":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"open_issues":46,"closed_issues":55,"state":"open","created_at":"2015-03-04T03:03:44Z","updated_at":"2015-05-19T07:39:23Z","due_on":"2015-05-19T12:00:00Z","closed_at":null},"comments":3,"created_at":"2015-05-18T15:09:40Z","updated_at":"2015-05-19T22:16:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/piwik/piwik/pulls/7931","html_url":"https://github.com/piwik/piwik/pull/7931","diff_url":"https://github.com/piwik/piwik/pull/7931.diff","patch_url":"https://github.com/piwik/piwik/pull/7931.patch"},"body":"This PR includes several improvements to test environment setup, and includes several DI related improvements.\r\n\r\nList of changes:\r\n\r\n1. Moved the following objects to DI: `Piwik\\Config`, `Piwik\\EventDispatcher`, `Piwik\\Access`, `Piwik_TestingEnvironment` (renamed to `Piwik\\Tests\\Framework\\TestingEnvironment`)\r\n\r\n2. Allow event observers to be defined before the DI container is created by creating a new `observers.global` DI entry.\r\n\r\n3. Removed use of the GlobalSettingsProvider singleton, it's no longer needed.\r\n\r\n4. Introduced the concept of EnvironmentManipulators (or possibly EnvironmentInterceptors). These are hooks that are only used for testing setup, and should not be used by plugins, plugin tests or core tests, only test environment setup.\r\n\r\n5. Test environment setup is done mostly by the test.php DI config now. The ContainerFactory will apply test.php DI config files (core + plugins) if PIWIK_TEST_MODE is defined, so it should not be needed to explicitly use the `'test'` environment name (ie, `new Environment('test')`).\r\n\r\n6. I had to re-enable logging in tests. This is only for ArchiveWebTest which tests log output of the archive.php script. Maybe it can be enabled conditionally via `DI\\decorate`.\r\n\r\n7. Added the ability for Integration tests and system tests to override DI config for tests (not just for child processes as is done currently). This is done by overriding `provideContainerConfig` for integration tests and `provideContainerConfigBeforeClass` for system tests.\r\n\r\n8. Moved Piwik\\Auth creation to DI only (instead of it being set in Login controller event). This required some tweaks to the Login auth class in order to fix local tracking. Since the Auth instance will end up being re-used when local tracking is called, we have to be able to clear all state before re-authenticating. So I made it possible to set the password/password hash to null. And added these sets to the Tracker.\r\n\r\nThere are still some TODOs left, but they are just about removing unused code + filling out docs."},"comment":{"url":"https://api.github.com/repos/piwik/piwik/issues/comments/103682536","html_url":"https://github.com/piwik/piwik/pull/7931#issuecomment-103682536","issue_url":"https://api.github.com/repos/piwik/piwik/issues/7931","id":103682536,"user":{"login":"diosmosis","id":125140,"avatar_url":"https://avatars.githubusercontent.com/u/125140?v=3","gravatar_id":"","url":"https://api.github.com/users/diosmosis","html_url":"https://github.com/diosmosis","followers_url":"https://api.github.com/users/diosmosis/followers","following_url":"https://api.github.com/users/diosmosis/following{/other_user}","gists_url":"https://api.github.com/users/diosmosis/gists{/gist_id}","starred_url":"https://api.github.com/users/diosmosis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diosmosis/subscriptions","organizations_url":"https://api.github.com/users/diosmosis/orgs","repos_url":"https://api.github.com/users/diosmosis/repos","events_url":"https://api.github.com/users/diosmosis/events{/privacy}","received_events_url":"https://api.github.com/users/diosmosis/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T22:16:28Z","updated_at":"2015-05-19T22:16:28Z","body":"I made most of the changes in your review. I will try to rewrite the commit history to make it easier to review on a commit by commit basis."}}