James Carr | Rants and Musings of an Agile Developer

CAT | php

Sep/12

9

Using Guard + PHPUnit for Great Good!

Another day, another post about the tooling I’ve been using to make PHP development bearable. Today I’ll share guard-phpunit, which I discovered thanks to a tip by @ctshryock.

I’ve been using this as a replacement for watchr which I use to autorun tests whenever I make code changes. I’ve switched to guard for a number of reasons, chief amongst them being the awesome notification support. You can use growl, libnotify and rb-notifu to notify test pass/fail.

Here’s the Guardfile I’ve been using. This is tailored for Zend Framework 2 so that whenever I modify a php class under a module directory it will run the tests for that particular class. Rapid feedback for the win!

No tags

Apr/07

26

What I Do When I’m Bored

I whipped this up in about 30 minutes using flickr’s developer API and some PHP. Added Lightbox2 javascript library for effect.

I forgot how fun PHP can be for quick and dirty things like this.

No tags

This afternoon I decided to try out the Blackjack TDD exercise again in php, and decided to go ahead and write a quick and simplistic interface to it, and put it up on my website to play around with. It was a fun waste of two hours, but what I’m happy about is that I have something to play with, although it’s broken in some ways. You can’t split. You can refresh the page and hit even after the game has completed. But the basics do work.

It’s actually been a fun little project… I’m thinking of spending the afternoon tomorrow extracting some rules out of it (and creating some) and implementing a rule processor to alow games with different rule sets (i.e. dealer must hit on soft 17, spanish 21 rules, etc). I’ll probably also implement a betting system and the capability to split hands and double down. Adding the capability for multiple players might be a fun addition to add in the near future as well.

Anyhow, for those who are interested, you can play with it here.

No tags

Theme Design by devolux.nh2.me