You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I might be a little confused here, but when I run \WP_Mock::expectActionAdded, I get an all OK from the test, but the expectActionAdded calls don't seem to count towards the assertion count. Am I doing something wrong or does that mean they're passing and they would return a PHP error if they weren't?
You're not doing anything wrong; setting up expectations in WP Mock don't have an impact on assertion counts because they're not really assertions. WP_Mock comes with some custom assertions to use, though, assuming you're using \WP_Mock\Tools\TestCase as the foundation of all your test classes.
$this->assertHooksAdded() // makes sure your expect*Added expectations were honored$this->assertActionsCalled() // makes sure your expected do_action()s were run$this->assertConditionsMet() // makes sure all WP Mock expectations have been met
So in your snippet above, I'd just tweak it to be:
(And again, this all assumes you're doing MyTestClassTests extends \WP_Mock\Tools\TestCase, not MyTestClassTests extends \PHPUnit_Framework_TestCase. Which you should be.)
I might be a little confused here, but when I run \WP_Mock::expectActionAdded, I get an all OK from the test, but the expectActionAdded calls don't seem to count towards the assertion count. Am I doing something wrong or does that mean they're passing and they would return a PHP error if they weren't?
The text was updated successfully, but these errors were encountered: