0

How we can do PHPUnit testing in wordpress website ? Including theme and plugin everything.

I have setup the phpunit and included wp-load.php file to get all functions and classes access.

Is this correct way ? or There is any better way of doing the Unit Testing in wordpress.

Kapil Yadav
  • 650
  • 1
  • 5
  • 29

1 Answers1

0

Have you read https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/ ? When writing unit testing you should ask yourself: What do i want this function to do? and then write the test based on that.

To answer your question if there is a correct way to write unit testing, I think it's not. its just a matter on how smart you write your tests. Go have a look at New to unit testing, how to write great tests? for some inspiration. Good luck!

Community
  • 1
  • 1
ER H
  • 74
  • 2
  • 7
  • Thanks for making it clear. I think i am on right track, i have written test cases for many webapps, I was just curious about standards. – Kapil Yadav Aug 08 '16 at 14:10