{"action":"closed","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/2040","repository_url":"https://api.github.com/repos/Codeception/Codeception","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/2040/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/2040/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/2040/events","html_url":"https://github.com/Codeception/Codeception/issues/2040","id":87474494,"number":2040,"title":"checkoption() cannot identify selector when HTML is rendered using variables in MVC view (2.0.14)","user":{"login":"onshop","id":2023203,"avatar_url":"https://avatars.githubusercontent.com/u/2023203?v=3","gravatar_id":"","url":"https://api.github.com/users/onshop","html_url":"https://github.com/onshop","followers_url":"https://api.github.com/users/onshop/followers","following_url":"https://api.github.com/users/onshop/following{/other_user}","gists_url":"https://api.github.com/users/onshop/gists{/gist_id}","starred_url":"https://api.github.com/users/onshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onshop/subscriptions","organizations_url":"https://api.github.com/users/onshop/orgs","repos_url":"https://api.github.com/users/onshop/repos","events_url":"https://api.github.com/users/onshop/events{/privacy}","received_events_url":"https://api.github.com/users/onshop/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Codeception/Codeception/labels/Needs%20clarification","name":"Needs clarification","color":"1abc9c"},{"url":"https://api.github.com/repos/Codeception/Codeception/labels/PhpBrowser","name":"PhpBrowser","color":"bdc3c7"}],"state":"closed","locked":false,"assignee":{"login":"zbateson","id":8356974,"avatar_url":"https://avatars.githubusercontent.com/u/8356974?v=3","gravatar_id":"","url":"https://api.github.com/users/zbateson","html_url":"https://github.com/zbateson","followers_url":"https://api.github.com/users/zbateson/followers","following_url":"https://api.github.com/users/zbateson/following{/other_user}","gists_url":"https://api.github.com/users/zbateson/gists{/gist_id}","starred_url":"https://api.github.com/users/zbateson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbateson/subscriptions","organizations_url":"https://api.github.com/users/zbateson/orgs","repos_url":"https://api.github.com/users/zbateson/repos","events_url":"https://api.github.com/users/zbateson/events{/privacy}","received_events_url":"https://api.github.com/users/zbateson/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-06-11T19:47:45Z","updated_at":"2016-06-11T20:37:58Z","closed_at":"2016-06-11T20:37:58Z","body":"I am using Zend Framework 2.3 with TWIG (1.18.2) . In my TWIG template I have the following check box bounded by TWIG conditionals:\r\n\r\n    {% if ( tempBusinessCase != null ) %}\r\n        <input type=\"checkbox\" value=\"{{ tempBusinessCase.getId() }}\" id=\"remove_temp_business_case\" name=\"removeTempBusinessCase\" \r\n        <label for=\"remove_temp_business_case\">Remove</label>\r\n    {% endif %}\r\n\r\nWhen I updated to 2.0.14 the following test failed:   \r\n\r\n    $I->checkOption( '//input[@id=\\'remove_temp_business_case\\']' );\r\n\r\nI got the following error:\r\n\r\n    Couldn't check option \"removeTempBusinessCase\":\r\n    InvalidArgumentException: Unreachable field \"removeTempBusinessCase\"\r\n\r\nThe following test preceding it passes so it is not a problem with the selector:\r\n\r\n    $I->seeElement( '//input[@id=\\'remove_temp_business_case\\']' );\r\n\r\nThe test worked in 1.8.7 and stopped working when I moved to 2.0.14. I then changed to 2.0.10 and the test works again.\r\n\r\nWhen the test fails the checkbox is shown in the output so it is there but checkOption cannot see it. It has something to do with the variable tempBusinessCase which is an instance of a class. It is passed to the template via the controller:\r\n\r\n    $parameters = array(\r\n        'form'                => $form\r\n      , 'tempBusinessCase'    => $tempBusinessCase );\r\n\r\n    $view = new  ViewModel( $parameters );\r\n    $view->setTemplate( 'requests/form.twig' );\r\n    return $view; \r\n\r\nIf I pass in other hardcoded variables set to true and use those as the conditional then selectOption() will check the box.\r\n\r\nI have tried to troubleshoot but I am not sure in which layer to look in. It would appear that $tempBusinessCase is not being evaluated before the  page is rendered and parsed and yet...\r\n\r\n   {{ dump(tempBusinessCase) }}\r\n\r\noutputs the class and the checkbox is also rendered.\r\n\r\nAs I say the test passes in 2.0.10 but not 2.0.14. Something introduced between those versions has changed the behaviour of selectOption()."}}
{"actor":{"display_login":"Naktibalda"}}