{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/2968","repository_url":"https://api.github.com/repos/Codeception/Codeception","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/2968/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/2968/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/2968/events","html_url":"https://github.com/Codeception/Codeception/pull/2968","id":146723346,"number":2968,"title":"Update Symfony2 framework module and connector, fix client generation…","user":{"login":"vyarmolenko","id":3118280,"avatar_url":"https://avatars.githubusercontent.com/u/3118280?v=3","gravatar_id":"","url":"https://api.github.com/users/vyarmolenko","html_url":"https://github.com/vyarmolenko","followers_url":"https://api.github.com/users/vyarmolenko/followers","following_url":"https://api.github.com/users/vyarmolenko/following{/other_user}","gists_url":"https://api.github.com/users/vyarmolenko/gists{/gist_id}","starred_url":"https://api.github.com/users/vyarmolenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vyarmolenko/subscriptions","organizations_url":"https://api.github.com/users/vyarmolenko/orgs","repos_url":"https://api.github.com/users/vyarmolenko/repos","events_url":"https://api.github.com/users/vyarmolenko/events{/privacy}","received_events_url":"https://api.github.com/users/vyarmolenko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Codeception/Codeception/labels/Not%20ready%20for%20merging","name":"Not ready for merging","color":"34495e"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-07T19:41:52Z","updated_at":"2016-04-08T10:51:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Codeception/Codeception/pulls/2968","html_url":"https://github.com/Codeception/Codeception/pull/2968","diff_url":"https://github.com/Codeception/Codeception/pull/2968.diff","patch_url":"https://github.com/Codeception/Codeception/pull/2968.patch"},"body":"…, update Doctrine EM retrieval. Improve memory usage. Unify service retrieval.\r\n\r\nThis PR provides solution for https://github.com/Codeception/Codeception/issues/2938, https://github.com/Codeception/Codeception/issues/2954.\r\n\r\nThis PR proposes the following model of Symfony2 framework module and client:\r\n- module's `$container` is a read-only property. It returns active client's service container during test execution or self service container between tests when accessed externally.\r\n- the module has `$persistentServices` array which contains services to persist between requests (kernel reboots) in a test.\r\n- the module has `$permanentServices` array which contains services to persist between tests.\r\n- persistence status of any service can be changed at any moment during test execution (public methods `persistService(...)` / `unpersistService(...)`).\r\n- the app kernel is booted during module initialization in order to make framework features available before client creation.\r\n- a client is created before each test. It is created based on current kernel, currently retrieved persistent services and a configuration option marking client's kernel rebootable between requests or not. Client's kernel is rebooted in its constructor to ensure clean environment for test. \r\n- client's persistent services are being updated before kernel shutdown and injected into newly initialized service container after kernel boot during test execution.\r\n- client's kernel can be rebooted using `$I->rebootClientKernel()` during test execution.\r\n- permanent services are updated after test execution.\r\n- cached router is permanent by default if used.\r\n- doctrine's EM service is permanent by default.\r\n\r\nTest results of Codeception's Symfony2 framework test app (https://github.com/Codeception/symfony-demo):\r\n![symfony2_test_app](http://content.screencast.com/users/vyarmolenko/folders/Jing/media/c55f8aa9-4fd4-4696-8558-dbb75dc4e174/2016-04-07_1129.png)\r\n\r\nTest results of modified version of https://github.com/AlexStansfield/codeception-test - an application used to reproduce https://github.com/Codeception/Codeception/issues/2025:\r\n![issue2025_test_app](http://content.screencast.com/users/vyarmolenko/folders/Jing/media/1f668fca-0c93-4fcc-bcc0-318909857489/2016-04-06_1930.png)\r\nModifications to this test app include:\r\n- creation of a copy of EntityCest.php - Entinty1Cest.php to check several cests in a suite, \r\n- making some methods of EntityCest.php to perform several `sendPOST(...)` requests to check correct work and measure performance of a solution.\r\n\r\nPerforming tests with modified version of Codeception on my Symfony2 app showed memory consumption was around 190 Mb's (previously tests failed due to insufficient memory with a 3GB's configuration) and execution time became around 19 minutes (and even lower - 11 minutes - with `config['cached_router'] = true`)\r\n\r\nThis PR also includes:\r\n- change retrieval of Doctrine's Entity Manager to make it compatible with new client generation logic and the model of persistent services and to avoid/solve https://github.com/Codeception/Codeception/issues/2025, https://github.com/Codeception/Codeception/issues/2853  \r\n- unification of service retrieval in existing public methods of Symfony2 module."},"comment":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/comments/207374524","html_url":"https://github.com/Codeception/Codeception/pull/2968#issuecomment-207374524","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/2968","id":207374524,"user":{"login":"raistlin","id":76889,"avatar_url":"https://avatars.githubusercontent.com/u/76889?v=3","gravatar_id":"","url":"https://api.github.com/users/raistlin","html_url":"https://github.com/raistlin","followers_url":"https://api.github.com/users/raistlin/followers","following_url":"https://api.github.com/users/raistlin/following{/other_user}","gists_url":"https://api.github.com/users/raistlin/gists{/gist_id}","starred_url":"https://api.github.com/users/raistlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raistlin/subscriptions","organizations_url":"https://api.github.com/users/raistlin/orgs","repos_url":"https://api.github.com/users/raistlin/repos","events_url":"https://api.github.com/users/raistlin/events{/privacy}","received_events_url":"https://api.github.com/users/raistlin/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T10:51:04Z","updated_at":"2016-04-08T10:51:04Z","body":"Rename of `grabServiceFromContainer` has been done to be consistent with other frameworks, that also have `grabService`."}}