Unit Test in Wordpress
I work in wordpress with a lot of classes that use wordpress functions and I'd like make unit tests for them. The problem I found is that phpunit doesn't recognize wordpress functions and the tests don't work.
I tried to include in the test class the index.php, wp-load.php and when they are included, phpunit doesn't work and exits through "exit code 0" without do anything -the error is shown in the PhpStorm Terminal. If I execute the command in the cmd, the cmd doesn't throw any information, just a blank line.
Php Version: 7.3.3 PhpUnit Version: 7.5.9 Wordpress Version: 4.9.1
An example of an error is to test for a class with "add_action" in their constructor and the error is: "Call to undefined function add_action()". I don't know what file I have to include for doing work this test or what is the method to test the class correctly.
Topic unit-tests php Wordpress
Category Web