Closed petekleinad closed 6 years ago
Hi there!
Thanks for providing so much detail: from the look of it looks like ACF is not loaded as the WPLoader
module cannot find it.
By default WPLoader
will search in the default WordPress folders from the root WordPress folder (the WP_ROOT_FOLDER
one); in Bedrock(-ish) setups that might not be the correct approach. To handle this case you can use configFile
parameter on WPLoader
to load a test configuration file that will help the module find the things to load.
I've also wrote an article about this particular setup here.
Let me know if that helps.
Hey, thanks so much for the direction. There were other issues with the way wp-config.php
was setup that prevented it from working (it was set up by a co-worker to work with Pantheon hosting). I ended up switching to a standard Bedrock setup and it worked like a charm.
Thanks again for your help, much appreciated!
Thanks for the update, happy testing.
What are you trying to achieve?
Trying to test functions that use
update_field()
from the Advanced Custom Fields plugin in awpunit
test.What do you get instead?
[Error] Call to undefined function AD\App\Fields\update_field()
. I have also tried prefixing my function with a\
in the executed code, in which case I get[Error] Call to undefined function update_field()
. I've also tried running the bootstrap (codecept wpbrowser init
) from different levels of the app, and I get the same result.The only warning I am receiving in my PHP error log is
PHP Warning: count(): Parameter must be an array or an object that implements Countable in /Applications/MAMP/htdocs/pawgo/web/wp/wp-includes/theme.php on line 711
, which is referencing this line:├── README.md ├── bin │ ├── build.sh │ ├── codecept -> ../web/wp-content/themes/pawgo/vendor/codeception/codeception/codecept │ ├── composer -> ../web/wp-content/themes/pawgo/vendor/composer/composer/bin/composer │ ├── deploy.sh │ ├── jsonlint -> ../web/wp-content/themes/pawgo/vendor/seld/jsonlint/bin/jsonlint │ ├── phpunit -> ../web/wp-content/themes/pawgo/vendor/phpunit/phpunit/phpunit │ ├── validate-json -> ../web/wp-content/themes/pawgo/vendor/justinrainbow/json-schema/bin/validate-json │ ├── wp -> ../web/wp-content/themes/pawgo/vendor/wp-cli/wp-cli/bin/wp │ ├── wp.bat -> ../web/wp-content/themes/pawgo/vendor/wp-cli/wp-cli/bin/wp.bat │ └── wpcept -> ../web/wp-content/themes/pawgo/vendor/lucatume/wp-browser/wpcept ├── composer.json ├── composer.lock ├── example.env ├── license.txt ├── pantheon.yml ├── web │ ├── codeception.dist.yml │ ├── index.php │ ├── tests │ │ ├── _data │ │ ├── _output │ │ ├── _support │ │ ├── acceptance │ │ ├── acceptance.suite.yml │ │ ├── functional │ │ ├── functional.suite.yml │ │ ├── unit │ │ ├── unit.suite.yml │ │ ├── wpunit │ │ └── wpunit.suite.yml │ ├── wp │ │ ├── README.md │ │ ├── index.php │ │ ├── license.txt │ │ ├── pantheon.upstream.yml │ │ ├── readme.html │ │ ├── wp-activate.php │ │ ├── wp-admin │ │ ├── wp-blog-header.php │ │ ├── wp-comments-post.php │ │ ├── wp-config-sample.php │ │ ├── wp-content │ │ ├── wp-cron.php │ │ ├── wp-includes │ │ ├── wp-links-opml.php │ │ ├── wp-load.php │ │ ├── wp-login.php │ │ ├── wp-mail.php │ │ ├── wp-settings.php │ │ ├── wp-signup.php │ │ ├── wp-trackback.php │ │ └── xmlrpc.php │ ├── wp-config.php │ └── wp-content │ ├── mu-plugins │ ├── plugins │ ├── themes │ ├── upgrade │ └── uploads └── wp-cli.yml
Details
composer show
)codeception.dist.yml
wpunit.suite.yml
I love this testing tool, thanks for making it, and I would appreciate any help or suggestions to get it working. Thanks in advance for any effort make to help!