News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Smashing Magazine:
Writing Unit Tests For WordPress Plugins
March 09, 2012 @ 10:46:32

On the Smashing Magazine site there's a recent post looking at how to unit test WordPress plugins via the frontend using QUnit (part of the jQuery project).

My first goal for the WordPress Editorial Calendar was to make it do anything useful. I was new to JavaScript and PHP and didn't really know what I could pull off. In a few days I had a proof of concept. In a few more I had a working version and was asking friends to install it. The calendar worked...sort of. I spent three times as much time fixing bugs as I did coding. Once the plugin worked, I wrote unit tests to make sure it kept working.

He introduces the QUnit testing tool and includes some sample tests showing you how to create both a pass/fail and how to test a PHP value passed out to the page via PHP. There's also a section on getting WordPress and QUnit integrated and only executing when there's a "qunit" parameter on the URL. Actual tests for his calendar plugin are included and you can see the results of the tests here.

0 comments voice your opinion now!
wordpress plugin unittest javascript jquery qunit


blog comments powered by Disqus

Similar Posts

Smartbridge.com: Rapid Website Development: The Case for LAMP and WordPress (Part 1)

International PHP Magazine: IPM Poll Question: How to Speed up Your Site?

Felix Geisendörfer's Blog: How to Plugin'ize Your App

Tobias Schlitt's Blog: Comfortable PHP editing with VIM -6-

NetTuts.com: Build Ajax Data Grids with CodeIgniter and jQuery


Community Events





Don't see your event here?
Let us know!


introduction language api install tips unittest opinion framework deployment laravel community podcast series library update interview symfony package release zendserver

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework