Asserting that an array contains another array in PHPUnit

I needed to test whether one array contained a subset of another array in PHPUnit. There’s no built-in function for that so if you have a similar need feel free to use the code below:


Read More

Ruby DataMapper aliased associations

In Ruby’s DataMapper ORM you can easily associate one type of object with another, e.g. an Image can have many Tags. For the most part DM takes care of the issue of pluralization, ie. if your tag object is Tag then the associated tag collection is accessed as image.tags However, what if you want to…


Read More

Logger version 4

I’ve updated my Flexible Logger to version 4. Changes for this version are: * split plugins into individual files * change error() to addError() to allow for a $logger->error(‘message’) method * rename underscored properties * better conformation to PSR standards * more inline documentation As usual you can clone the source from my GitHub repo…


Read More

AutoLoader version 3

I’ve updated my PHP Auto Loader to version 3. Changes are as follows: * A new index system * Improved checking of missing classes * Improved debugging * A smarter caching system * Better locking mechanism In order to better comply with the PSR standards I’ve been refactoring some of my code. As a result…


Read More

Phishers getting a free pass

Yesterday I received a phishing email with an HTML attachment. The HTML contained a form containing banking details which would be POSTed to a particular URL. (eg: http://somedodgysite.com/carddetails.php) After filling in the form with junk and posting it, I noticed that the response redirected my browser to a genuine banking page. I reported the site…


Read More

Doctrine 1 alternative

I’m working with a lot of projects that use Doctrine1. The ORM is ageing somewhat and has been criticised for its performance overhead. At my current job I have written a REST API that provides an easy means of interacting with Doctrine models, much like Ruby on Rails does. It works very well and performs beyond our…


Read More

JEditable – custom field name

I love JEditable, it’s an extremely useful way of having editable content on a page. I did come up against a limitation though. The name of the field is determined by the ID attribute of the containing DIV (or other element). Consider the following where you want fields to be editable for two different companies…


Read More

Code on GitHub

I have started putting my public code onto GitHub. To get the latest copies of code, please use this link: https://github.com/opensourceame I will be documenting the process manager classes soon…


Read More