Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHPUnit_Framework_Exception] implode(): Invalid arguments passed #3608

Closed
prazmok opened this issue Oct 14, 2016 · 5 comments
Closed

[PHPUnit_Framework_Exception] implode(): Invalid arguments passed #3608

prazmok opened this issue Oct 14, 2016 · 5 comments
Labels

Comments

@prazmok
Copy link

@prazmok prazmok commented Oct 14, 2016

I wanted to test homepage using functional tester amOnRoute method which is part of Symfony module. As a result I get an error:

1) DefaultControllerCest: Check if default page response is correct
 Test  tests/functional/AppBundle/Controller/DefaultControllerCest.php:homepageTest

  [PHPUnit_Framework_Exception] implode(): Invalid arguments passed  


Scenario Steps:

 1. $I->amOnRoute("app_homepage",{"_locale":"en"}) at tests/functional/AppBundle/Controller/DefaultControllerCest.php:20

/path/to/project/vendor/codeception/codeception/src/Codeception/Module/Symfony.php:480
/path/to/project/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php:191
/path/to/project/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php:238
/path/to/project/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php:330
/path/to/project/vendor/codeception/codeception/src/Codeception/Module/Symfony.php:324
/path/to/project/vendor/codeception/codeception/src/Codeception/Step.php:259
/path/to/project/vendor/codeception/codeception/src/Codeception/Scenario.php:69
/path/to/project/tests/_support/_generated/FunctionalTesterActions.php:76
/path/to/project/tests/functional/AppBundle/Controller/DefaultControllerCest.php:20
/path/to/project/vendor/codeception/codeception/src/Codeception/Lib/Di.php:121
/path/to/project/vendor/codeception/codeception/src/Codeception/Test/Cest.php:135
/path/to/project/vendor/codeception/codeception/src/Codeception/Test/Cest.php:147
/path/to/project/vendor/codeception/codeception/src/Codeception/Test/Cest.php:81
/path/to/project/vendor/codeception/codeception/src/Codeception/Test/Test.php:82
/path/to/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:753
/path/to/project/vendor/codeception/codeception/src/Codeception/PHPUnit/Runner.php:98
/path/to/project/vendor/codeception/codeception/src/Codeception/SuiteManager.php:162
/path/to/project/vendor/codeception/codeception/src/Codeception/Codecept.php:209
/path/to/project/vendor/codeception/codeception/src/Codeception/Codecept.php:178
/path/to/project/vendor/codeception/codeception/src/Codeception/Command/Run.php:329
/path/to/project/vendor/codeception/codeception/src/Codeception/Command/Run.php:256
/path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:257
/path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:829
/path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
/path/to/project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
/path/to/project/vendor/codeception/codeception/src/Codeception/Application.php:103
/path/to/project/vendor/codeception/codeception/codecept:33
use \FunctionalTester;

class DefaultControllerCest
{
    public function homepageTest(FunctionalTester $I)
    {
        $I->wantTo('Check if default page response is correct');
        $I->amOnRoute('app_homepage', ['_locale' => 'en']);
    }
}

I digged a little bit deeper and found probable cause of problem in $profile->getCollection('security')->getRoles(). My Symfony security.yml configuration looks like

security:
    role_hierarchy:
        ROLE_ADMIN: ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        in_memory:
            memory: ~

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~

Details

  • Codeception version: 2.2.5
  • PHP Version: 7.0.8
  • Operating System: OS X 10.11.6 (15G1004)
  • Installation type: Composer
  • Suite configuration:
class_name: FunctionalTester
modules:
    enabled:
        - Symfony2:
            app_path: 'app'
            var_path: 'var'
            environment: 'test'
        - Doctrine2:
            depends: Symfony2
        - \Helper\Functional
@Naktibalda
Copy link
Member

@Naktibalda Naktibalda commented Oct 14, 2016

@prazmok can you fix it?

@prazmok
Copy link
Author

@prazmok prazmok commented Oct 14, 2016

I can have a look at it.

@prazmok
Copy link
Author

@prazmok prazmok commented Oct 14, 2016

Problem occurs only for Symfony ~3.2 and the problem is caused by https://github.com/symfony/security-bundle/blob/master/DataCollector/SecurityDataCollector.php#L111. In previous versions routes value was an array but in newer version it is instance of \Symfony\Component\VarDumper\Cloner\Data.

@DavertMik
Copy link
Member

@DavertMik DavertMik commented Oct 14, 2016

@prazmok yep, if you already discovered that please help us to fix that so to make next release to be compatible with Symfony 3.2

@DavertMik DavertMik added the Symfony label Oct 14, 2016
@prazmok
Copy link
Author

@prazmok prazmok commented Oct 14, 2016

Ofc:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.