{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/3393","repository_url":"https://api.github.com/repos/Codeception/Codeception","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/3393/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/3393/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/3393/events","html_url":"https://github.com/Codeception/Codeception/issues/3393","id":168609549,"number":3393,"title":"API REST Cannot declare class Symfony\\Component\\HttpFoundation [...] because the name is already in use in [...]/var/bootstrap.php.cache","user":{"login":"jpsymfony","id":12496985,"avatar_url":"https://avatars.githubusercontent.com/u/12496985?v=3","gravatar_id":"","url":"https://api.github.com/users/jpsymfony","html_url":"https://github.com/jpsymfony","followers_url":"https://api.github.com/users/jpsymfony/followers","following_url":"https://api.github.com/users/jpsymfony/following{/other_user}","gists_url":"https://api.github.com/users/jpsymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/jpsymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpsymfony/subscriptions","organizations_url":"https://api.github.com/users/jpsymfony/orgs","repos_url":"https://api.github.com/users/jpsymfony/repos","events_url":"https://api.github.com/users/jpsymfony/events{/privacy}","received_events_url":"https://api.github.com/users/jpsymfony/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Codeception/Codeception/labels/Symfony","name":"Symfony","color":"bdc3c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-01T09:58:10Z","updated_at":"2016-08-02T14:38:07Z","closed_at":null,"body":"#### What are you trying to achieve?\r\nI'm trying to launch all my tests (unit + api) in Symfony3.1. When I separately launch them, everything goes well, but if I launch /vendor/bin/codecept run, unit tests are properly launched and are successful, but the api test always fails and are not lauched.\r\n\r\n### Details\r\n\r\n* Codeception version: 2.2.3\r\n* PHP Version: 7\r\n* Operating System: Ubuntu\r\n* Installation type: Composer\r\n* Suite configuration:\r\n\r\n```yml\r\nclass_name: ApiTester\r\nmodules:\r\n    enabled:\r\n        - \\AppBundle\\Helper\\Api\r\n        - REST:\r\n            url: /v1\r\n            depends: Symfony\r\n        - Doctrine2:\r\n            depends: Symfony\r\n        - Symfony:\r\n            app_path: '../../app'\r\n            var_path: '../../var'\r\n```\r\n\r\nHere's my codeception.yml\r\n```yaml\r\nactor: Tester\r\npaths:\r\n    tests: tests\r\n    log: tests/_output\r\n    data: tests/_data\r\n    support: tests/_support\r\n    envs: tests/_envs\r\nsettings:\r\n    bootstrap: _bootstrap.php\r\n    colors: true\r\n    memory_limit: 1024M\r\nextensions:\r\n    enabled:\r\n        - Codeception\\Extension\\RunFailed\r\nmodules:\r\n    config:\r\n        Db:\r\n            dsn: ''\r\n            user: ''\r\n            password: ''\r\n            dump: tests/_data/dump.sql\r\ninclude:\r\n    - src/AppBundle\r\ncoverage:\r\n    enabled: true\r\n    whitelist:\r\n        include:\r\n            - src/*\r\n        exclude:\r\n            - src/AppBundle/Entity/*\r\n            - src/AppBundle/tests/*\r\n            - src/AppBundle/codeception.yml\r\n```\r\nAny idea how I could do? I have the following call stack:\r\n```\r\nCall Stack:\r\n    0.0003     366728   1. {main}() /var/www/metadata/vendor/codeception/codeception/codecept:0\r\n    0.0491    4670576   2. Codeception\\Application->run() /var/www/metadata/vendor/codeception/codeception/codecept:33\r\n    0.0491    4670576   3. Symfony\\Component\\Console\\Application->run() /var/www/metadata/vendor/codeception/codeception/src/Codeception/Application.php:103\r\n    0.0507    4815576   4. Symfony\\Component\\Console\\Application->doRun() /var/www/metadata/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:117\r\n    0.0508    4815576   5. Symfony\\Component\\Console\\Application->doRunCommand() /var/www/metadata/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:186\r\n    0.0508    4815576   6. Symfony\\Component\\Console\\Command\\Command->run() /var/www/metadata/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:815\r\n    0.0512    4818056   7. Codeception\\Command\\Run->execute() /var/www/metadata/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:256\r\n    0.1006    6650440   8. Codeception\\Command\\Run->runIncludedSuites() /var/www/metadata/vendor/codeception/codeception/src/Codeception/Command/Run.php:261\r\n    0.1042    6657592   9. Codeception\\Command\\Run->runSuites() /var/www/metadata/vendor/codeception/codeception/src/Codeception/Command/Run.php:298\r\n    0.1660    9802776  10. Codeception\\Codecept->run() /var/www/metadata/vendor/codeception/codeception/src/Codeception/Command/Run.php:329\r\n    0.1676    9807696  11. Codeception\\Codecept->runSuite() /var/www/metadata/vendor/codeception/codeception/src/Codeception/Codecept.php:178\r\n    0.1693   10023184  12. Codeception\\SuiteManager->initialize() /var/www/metadata/vendor/codeception/codeception/src/Codeception/Codecept.php:207\r\n    0.1693   10023184  13. Codeception\\Module\\Symfony->_initialize() /var/www/metadata/vendor/codeception/codeception/src/Codeception/SuiteManager.php:81\r\n```\r\n\r\nI followed it but the problem comes from the SuiteManager, when it calls the _initialize method of my AppBundle\\Helper\\Api which is quite simple:\r\n\r\n```php\r\n<?php\r\nnamespace AppBundle\\Helper;\r\n\r\n// here you can define custom actions\r\n// all public methods declared in helper class will be available in $I\r\n\r\nclass Api extends \\Codeception\\Module\r\n{\r\n    /**\r\n     * Checks over the given HTTP header and (optionally)\r\n     * its value, asserting that are there\r\n     *\r\n     * @param $header\r\n     * @param $value\r\n     */\r\n    public function seeHttpHeaderLike($header, $value)\r\n    {\r\n        $header = $this->getModule('REST')->grabHttpHeader($header);\r\n        $this->assertRegExp($value, $header);\r\n    }\r\n}\r\n```\r\n\r\nI always have the same error:\r\nFatal error: Cannot declare class Symfony\\Component\\HttpFoundation\\FileBag, because the name is already in use in [...]/var/bootstrap.php.cache on line 308\r\n\r\nIf I removed some code calling the FileBag (request attributes), I have the same error but with Symfony\\Component\\HttpFoundation\\Request\r\n\r\nThanks in advance"},"comment":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/comments/236924661","html_url":"https://github.com/Codeception/Codeception/issues/3393#issuecomment-236924661","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/3393","id":236924661,"user":{"login":"linconnu","id":5654826,"avatar_url":"https://avatars.githubusercontent.com/u/5654826?v=3","gravatar_id":"","url":"https://api.github.com/users/linconnu","html_url":"https://github.com/linconnu","followers_url":"https://api.github.com/users/linconnu/followers","following_url":"https://api.github.com/users/linconnu/following{/other_user}","gists_url":"https://api.github.com/users/linconnu/gists{/gist_id}","starred_url":"https://api.github.com/users/linconnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linconnu/subscriptions","organizations_url":"https://api.github.com/users/linconnu/orgs","repos_url":"https://api.github.com/users/linconnu/repos","events_url":"https://api.github.com/users/linconnu/events{/privacy}","received_events_url":"https://api.github.com/users/linconnu/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T14:38:07Z","updated_at":"2016-08-02T14:38:07Z","body":"I have the same error and it comes from the `require_once` here: https://github.com/Codeception/Codeception/blob/2.2/src/Codeception/Module/Symfony.php#L149\r\n\r\nIt seems like the _initialize function from this class is not compatible with Symfony 3.1. If i remove the lines below, my problem is solved: \r\n```php\r\n$cache = Configuration::projectDir() . $this->config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache';\r\nif (!file_exists($cache)) {\r\n    throw new ModuleRequireException(__CLASS__,\r\n        \"Symfony bootstrap file not found in $cache\\n \\n\" .\r\n        \"Please specify path to bootstrap file using `var_path` config option\\n \\n\" .\r\n        \"If you are trying to load bootstrap from a Bundle provide path like:\\n \\n\" .\r\n        \"modules:\\n    enabled:\\n\" .\r\n        \"    - Symfony:\\n\" .\r\n        \"        var_path: '../../app'\\n\" .\r\n        \"        app_path: '../../app'\"\r\n    );\r\n}\r\nrequire_once $cache;\r\n```\r\n\r\nAll vendors are already loaded here: https://github.com/Codeception/Codeception/blob/2.2/autoload.php#L6\r\n\r\nAnd if i want to use the Symfony autoload located in app/, i can do it in my codeception _bootstrap file.\r\n\r\nAre we doing something wrong or is it a bug? "}}
{"actor":{"display_login":"linconnu"}}