·

database

Ordering and grouping results in MySQL

In MySQL when you are fetching a result set and you need to order a result set that is grouped by a column, you might notice some unexpected behaviour. Take the following dataset: person_id score 1 100 2 120 2 180 1 150 3 200 3 150 2 140 1 130 Now we have the read further ...

PHPUnit setup and teardown for tables

When you’re unit testing your code with PHPUnit, chances are that at some point you have to test some methods that involve manipulation on the database. Of course, you’ve written some test that validate the data in the database afterwards, and you might already have written a bootstrap that prepares the database for each testrun, but what read further ...

Unit testing Magento with the database

This year I want to dive more into unit testing in PHP. Writing good, test-driven code is important for the stability and guarantee of your project, but it also helps you – as a developer – sleep a little better at night. You might have seen earlier posts regarding unit testing in PHP in the past, read further ...