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

WPLoader throws an exception, $merged_filters is not an array #60

Closed
forjoyilive opened this issue Dec 5, 2016 · 4 comments
Closed
Assignees
Labels

Comments

@forjoyilive
Copy link

Hi, I'm new to testing of this kind, so let me know if I'm missing something.

When I run wpcept run I get this error before the integration tests run:
array_intersect_key(): Argument #1 is not an array

Commenting out the WPLoader line in the integration.suite.yml file "fixes" the problem. Here's a verbose output:

    Including plugin [ananda-x/ananda-x.php] files

      The following tables will be dropped: 
      	- posts
      	- comments
      	- links
      	- options
      	- postmeta
      	- terms
      	- term_taxonomy
      	- term_relationships
      	- termmeta
      	- commentmeta
      
      Installing WordPress...
      Installing network...
      
      Network activating plugin [ananda-x/ananda-x.php]...
   
                                                          
      [PHPUnit_Framework_Exception]                       
      array_intersect_key(): Argument #1 is not an array  
                                                          
    
    Exception trace:
     () at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:75
     Codeception\Subscriber\ErrorHandler->errorHandler() at n/a:n/a
     array_intersect_key() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/lucatume/wp-browser/src/includes/tad-functions.php:29
     _without_filters() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/lucatume/wp-browser/src/includes/bootstrap.php:146
     require_once() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:229
     Codeception\Module\WPLoader->loadWordPress() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:151
     Codeception\Module\WPLoader->initialize() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:139
     Codeception\Module\WPLoader->_initialize() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/SuiteManager.php:81
     Codeception\SuiteManager->initialize() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/Codecept.php:207
     Codeception\Codecept->runSuite() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/Codecept.php:178
     Codeception\Codecept->run() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/Command/Run.php:359
     Codeception\Command\Run->runSuites() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/Command/Run.php:286
     Codeception\Command\Run->execute() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/symfony/console/Command/Command.php:257
     Symfony\Component\Console\Command\Command->run() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/symfony/console/Application.php:849
     Symfony\Component\Console\Application->doRunCommand() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/symfony/console/Application.php:193
     Symfony\Component\Console\Application->doRun() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/symfony/console/Application.php:124
     Symfony\Component\Console\Application->run() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/src/Codeception/Application.php:103
     Codeception\Application->run() at /Users/nabhacosley/Sites/ananda-designs/plugins/ananda-x/vendor/codeception/codeception/codecept:33

Here's my WPLoader config with a few details obfuscated.

    WPLoader:
          multisite: true
          wpRootFolder: "/Users/nabhacosley/Local Sites/ananda-designs/app/public/"
          dbName: "local_wploader"
          dbHost: "..."
          dbUser: "..."
          dbPassword: "..."
          isolatedInstall: true
          wpDebug: true
          dbCharset: "utf8"
          dbCollate: ""
          tablePrefix: "wptests_"
          domain: "ananda-designs.dev"
          adminEmail: "[email protected]"
          title: "Ananda Designs Tests"
          phpBinary: "php"
          language: ""
          configFile: ""
          plugins: ['ananda-x/ananda-x.php']
          activatePlugins: ['ananda-x/ananda-x.php']
          booststrapActions: []

And integration.suite.yml:

    class_name: IntegrationTester
    modules:
        enabled:
            - \Helper\Integration
            - WPLoader
@lucatume lucatume self-assigned this Dec 5, 2016
@lucatume lucatume added the bug label Dec 5, 2016
@lucatume
Copy link
Owner

lucatume commented Dec 5, 2016

Thanks for opening the issue and thank you for the detailed report: that helps a lot.

I will look into this as soon as possible and update the issue as soon as I've made progress on this.

@JDGrimes
Copy link

JDGrimes commented Dec 5, 2016

This has to do with WordPress 4.7 no longer using the $merged_filters global. See WordPoints/wordpoints#510 for where I fixed a similar issue in the PHPUnit tests for one of my plugins. Basically, you need to check if $GLOBALS['merged_filters'] is set before doing anything with it, because after 4.7 it won't be.

@forjoyilive
Copy link
Author

That's right, I'm on WP 4.7 RC 1. Didn't think to mention it!

@lucatume
Copy link
Owner

lucatume commented Dec 7, 2016

thanks to both for the details and helps!

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

No branches or pull requests

3 participants