PHPNews

Using closures as PHPUnit After Hooks

Not sure why I didn't start doing this sooner. We have a basic Feature toggle system that is maintained in the global scope to make it easily accessible to any part of the code: Feature::isEnabled("something_awesome"); I needed to force a particular feature on in a PHPUnit integration test, but in order to …

Continue reading »

Written by Dave Marshall - - Aggregated on Friday December 23, 2016


Using closures as PHPUnit After Hooks

Not sure why I didn't start doing this sooner. We have a basic Feature toggle system that is maintained in the global scope to make it easily accessible to any part of the code: Feature::isEnabled("something_awesome"); I needed to force a particular feature on in a PHPUnit integration test, but in order to …

Continue reading »

Written by Dave Marshall - - Aggregated on Friday December 23, 2016


Faster Tests in PHP: Organising Test Suites

One way of keeping your test suites running fast is by organising them in a way that allows you to run the right tests at the right time. This might be running the faster, isolated tests to give you instant feedback in your TDD loop, or it might be running the most critical acceptance tests before you commit …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday November 16, 2016


Faster Tests in PHP: Organising Test Suites

One way of keeping your test suites running fast is by organising them in a way that allows you to run the right tests at the right time. This might be running the faster, isolated tests to give you instant feedback in your TDD loop, or it might be running the most critical acceptance tests before you commit …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday November 16, 2016


Faster Tests in PHP: Avoiding latency with Fakes

Faster tests get run more often. Fast tests are critical for people practicing TDD, keeping that feedback loop nice and tight. One of my favourite ways to keep tests running on time is to minimise the amount of waiting on I/O needed to exercise the system. There are a handful of ways to do this, it's quite common …

Continue reading »

Written by Dave Marshall - - Aggregated on Tuesday November 8, 2016


Faster Tests in PHP: Avoiding latency with Fakes

Faster tests get run more often. Fast tests are critical for people practicing TDD, keeping that feedback loop nice and tight. One of my favourite ways to keep tests running on time is to minimise the amount of waiting on I/O needed to exercise the system. There are a handful of ways to do this, it's quite common …

Continue reading »

Written by Dave Marshall - - Aggregated on Tuesday November 8, 2016


Service Locators have their place

I was prompted to write this post after seeing a couple of things pop up in my timeline. Service locators don’t belong in controllers - https://t.co/XrtxBTlbtp — Brandon Savage (@brandonsavage) June 1, 2016 Brandon's article carries an overarching message and he states it in his rule …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday June 1, 2016


Service Locators have their place

I was prompted to write this post after seeing a couple of things pop up in my timeline. Service locators don’t belong in controllers - https://t.co/XrtxBTlbtp — Brandon Savage (@brandonsavage) June 1, 2016 Brandon's article carries an overarching message and he states it in his rule …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday June 1, 2016


Verifying Doubles in PHP

A common concern that gets raised about using test doubles (mocks, stubs, spies etc) , is that of the configuration of the test double stubs or expectations being out of sync with the signatures of the actual type. Probably best explained with an example. interface UserRepository { } class Foo { /* ... */ …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday April 20, 2016


Verifying Doubles in PHP

A common concern that gets raised about using test doubles (mocks, stubs, spies etc) , is that of the configuration of the test double stubs or expectations being out of sync with the signatures of the actual type. Probably best explained with an example. interface UserRepository { } class Foo { /* ... */ …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday April 20, 2016


Verifying Doubles in PHP

A common concern that gets raised about using test doubles (mocks, stubs, spies etc) , is that of the configuration of the test double stubs or expectations being out of sync with the signatures of the actual type. Probably best explained with an example. interface UserRepository { } class Foo { /* ... */ …

Continue reading »

Written by Dave Marshall - - Aggregated on Wednesday April 20, 2016


Effective tests: Setting up a database fixture

For most of us in the PHP community, writing our first integrated test usually means interacting with a database. For too long I considered this a difficult and frustrating thing to do, so I avoided it, leaving code either uncovered, or covered with overly specified tests using way too many test doubles. Most of …

Continue reading »

Written by Dave Marshall - - Aggregated on Monday October 26, 2015


Effective tests: Setting up a database fixture

For most of us in the PHP community, writing our first integrated test usually means interacting with a database. For too long I considered this a difficult and frustrating thing to do, so I avoided it, leaving code either uncovered, or covered with overly specified tests using way too many test doubles. Most of …

Continue reading »

Written by Dave Marshall - - Aggregated on Monday October 26, 2015


Effective tests: Setting up a database fixture

For most of us in the PHP community, writing our first integrated test usually means interacting with a database. For too long I considered this a difficult and frustrating thing to do, so I avoided it, leaving code either uncovered, or covered with overly specified tests using way too many test doubles. Most of …

Continue reading »

Written by Dave Marshall - - Aggregated on Monday October 26, 2015