Best Practices

Eric Hogue on February 12th, 2013

The subject of mocking a PDO object in PHPUnit has come around a few times lately. It cannot be done like normal classes because a PDO object cannot be serialized. $pdo = $this->getMockBuilder(‘PDO’) ->disableOriginalConstructor() ->getMock(); This will work on another class, but with PDO you will get this error: PDOException: You cannot serialize or unserialize […]

Continue reading about Mocking PDO in PHPUnit

Eric Hogue on September 3rd, 2012

A few months ago, I wrote about continuous testing. When I wrote that post, I was using watchr to run my tests. A few weeks ago, I started using Guard instead of watchr and I wouldn’t go back. Reasons to Change One of the problems I had with watchr, is that it did not see […]

Continue reading about Continuous Testing in PHP with Guard

Eric Hogue on April 9th, 2012

Continuous testing is a way to automate the execution of your tests while you work. This makes the feedback loop very short. As soon as you save a file, the tests are run and you know right away if anything fails. Autotest I discovered continuous testing over a year ago when I watched a video […]

Continue reading about Continuous Testing in PHP

Eric Hogue on June 8th, 2011

Test driven development (TDD) is at the core of the Agile Methodology and Extreme Programming. This practice has been known for a while and a lot have been written on it. However, I still meet developers that don’t know what it is. I understand that many employers won’t let their employees write tests, but we […]

Continue reading about Test Driven Development in PHP

Eric Hogue on May 25th, 2011

Last Saturday I had the privilege of attempting a code retreat in Quebec City. I have been hoping for this for a while, so I registered as soon as I found out about it. When I learned that Corey Haines and J. B. Rainsberger where going to be there I was really thrilled. The Setup […]

Continue reading about Code Retreat Quebec

Eric Hogue on May 9th, 2011

In a previous post, I talked about Continuous Integration. If your Continuous Integration server runs on every commits, it will help you keep your code quality high. It will also make integration a non issue. However, when I make a mistake, produce sub-optimal code or if I write code that does not respect our coding […]

Continue reading about PHP Tool Integration (PHPsrc)

Eric Hogue on May 3rd, 2011

According to Wikipedia, continuous integration implements continuous processes of applying quality control — small pieces of effort, applied frequently. In simple terms, you verify that your project meets the quality standards frequently. This way, you can catch any deviation early. Doing the integration in small increments makes it easier. Implementing a continuous integration server can […]

Continue reading about Continuous Integration In PHP