6

Is it possible to implement PHPUnit into Craft CMS? If so, where can I find a good explanation or tutorial? I already tried a Github link for a plugin (testing the plugin).

But I am new to both but really want to TDD the plugins. Any example pages or a quick guide would be great!

Luke Pearce
  • 3,863
  • 1
  • 11
  • 25
Bram B
  • 353
  • 1
  • 9

1 Answers1

3

There is a good example of testing with PHPUnit in a Craft plugin here: https://github.com/selvinortiz/craft.loath and an example on how to stub out the global craft() class here: Stub out the global craft() object for PHPUnit tests

Note that testing in Craft should be a lot easier/convenient in the upcoming Craft 3.

Brad Bell
  • 67,440
  • 6
  • 73
  • 143
  • 4
    In the upcoming Craft 3, it would be great if there came a section where Craft 3 and PHPUnit had a nice tutorial for beginners to write good plugins?

    Anyway thanks for the answer!

    – Bram B Aug 12 '16 at 12:30