Automated Testing in WordPress

For about 5 years, WordPress was my primary platform and having been bit by the TDD bug by other frameworks and communities, I was very keen on applying Automated Testing to my programming practice, even in WordPress. I had some pretty good success with unit testing PHP classes I wrote for use in plugins but didn’t go too much deeper with it. I knew that there were some unit tests for WP core floating around out there, but it was my understanding that they were kind of languishing in obscurity. Well, that changed recently and I was so excited by the news that I applied to speak about it at WordCamp Chicago, which I did this past weekend.

After hanging out with the community on Saturday and getting temperature checks from attendees, I realized I needed to take a different approach. Instead of the planned TDD lecture, I opted to do an interactive code session and showed people how to install PHPUnit and explore the WordPress Test Suite. If you missed it, you can follow my session notes to get the WordPress Unit Tests up and running on your machine.

The session seemed to be well received, as it generated pretty good responses from the audience. I was able to weave in some of the themes from the software craftsmanship movement that I feel are underrepresented in the PHP community, which I’ve done before.

I also touched on the plugin quality discussion that’s been going on in the WP community of late and how I felt testing and social coding features could help improve that.

And while I’m thrilled at the response, this is just the beginning. There is still a long way to go before we’ll be downloading plugins from dotorg with full test suites. It is my hope that in small part talks like mine will inspire others to dig deeper into TDD and start to practice it in their WordPress projects.

xentek.net, rebooted

Hello Readers, new and old!

For about the last 5 years, xentek.net has rocked the same look and feel, and in the last 2 years or so updates had slowed to a crawl. Well, I finally got around to dusting off the ol’ girl, upgrading WordPress (ashamedly from some pre-release WP 3.0 to absolute 3.4-alpha), switching to a slightly tweaked version of Darryl Koopersmith’s Hum child theme for twentytwelve, and re-kajiggering my deployment process. I’ve removed a number of pages and assets, as I pretty much started over from scratch (importing my content into a new blog, instead of upgrading the existing one).

Hopefully by completing all of these long overdue upgrades, I will finally get back to putting out new content, and indeed I already have. I freshened up my about page, and updated my contact info. I’ve also cleaned up my the pages linking to my open source contributions, and added a few new items:

I can’t promise that I will write on a regular basis, but with a fresh start, I do hope that I’m more inclined to do so. Thanks for reading, and happy coding!

Enabling the Flash Uploader in WordPress on your Password Protected Dev Sites

If you post the sites your working on so that your clients can show of your progress, no doubt you are password protecting it with .htpasswd. There is one drawback to this approach, the Flash Uploader will throw an HTTP Error when HTTP Basic Authentication is used. Put the following snippet in your VirtualHost file to fix that error.

<Files async-upload.php>
Order deny,allow
Allow from all
Satisfy Any
</Files>

Time, Skill, and Vision

Ryan Price and I have recorded the second episode of our occasional podcast, Our Yellow House. In this installament we trip over a new Iron Triangle: Vision, Time, and Skill and how it relates to doing creative work. It breaks down like this: With enough time, you can create. With enough skill and time, you can create anything. But creating something that moves people also requires a great amount of Vision as well.

Continue reading

!= but ==

In all the fervor surrounding today’s launch of the seventh major release of Drupal, I ran across a post pitting Drupal 7 vs. WordPress 3.0 in a basic comparison of features.

The post was not published recently or anything, but the underlying tone of the article is summed up in a couple of Tweets quoted near the bottom of the post:

RT @chx1975: WordPress is now approximately where Drupal was around Drupal 5 w/ content types. See you in 2015.

RT @newoceans_en: @Dries Drupal 7 will hopefully be where WordPress was around 5 years ago regarding UX.

I get it. Its all great fun to get into a pissing match with a friendly rival, at least until somebody gets wet, but to me this smacks of the ‘Editor War‘ between vi and emacs; forever the flame that lights the nooks and crannies of hacker culture.
Continue reading

Image/Attachment Templates for WordPress

Ever since about WordPress v2.6 or so, images you uploaded and inserted into a WordPress post were created as attachments, a sub-post type that belongs to the post or page they are attached to. These attachment posts can be given their own template, and indeed they look for one when you visit the attachment’s permalink. The K2 theme ships with image and attachment templates (named image.php and attachment.php in the theme template hierachy) and displays the file along with some meta data and, if the image is a part of a gallery (or there is more than one attachment on the post), navigation aids to move from one attachment to the next. For many sites this is ideal, but if you want to just give people the file, and avoid having to create these attachment templates, then here’s a neat trick I cooked up on a recent project.
Continue reading

Our Yellow House

Last week I had the extreme pleasure of joining Ryan Price of Drupal Easy on a new podcast he launched called Our Yellow House. This podcast takes an unstructured, conversational tone and attempts to really capture “two people talking”. We wandered around a bit, but in this episode we touched on the recent GPL/thesiswp debate, Chat Roulette and Freelancing. Give it a listen and let me know what you think.

The GPL talk also spilled over into the Drupal Easy podcast, and tackles the issue from the Drupal community’s point of view (and also mentions my appearance on Our Yellow House). Checking that out is also worth your time.

Continue reading