PHPNews

Importing HIBP's pwned password list in to DynamoDB

Written by Dave Marshall - Published on Dave Marshall's weblog
Aggregated on Friday August 11, 2017 - Permalink

Troy Hunt recently introduced HIBP Passwords , a freely downloadable list of over 300 million passwords that have been pwned in the various breaches the site records. There is an API to access the list for auditing and checking passwords, but it's rate limited, and I thought it would be more friendly to import the passwords in to a database we control. It looks like HIBP uses Azure …

Continue reading »


Test Data Builders

Written by Dave Marshall - Published on Dave Marshall's weblog
Aggregated on Wednesday January 28, 2015 - Permalink

I recently covered Object Mothers , a pattern that provides factory methods for creating example objects for use in tests. That post showed how Object Mothers are effective to begin with, but can quickly become unmanageable. A better alternative to Object Mothers is to use the Builder pattern. Nat Pryce has a series of great posts on this subject, which I'm going to pull together here in …

Continue reading »


Scheduled Tasks with Jenkins

Written by Dave Marshall - Published on Dave Marshall's weblog
Aggregated on Thursday June 4, 2015 - Permalink

I was recently introduced to using Jenkins as a replacement for cron and I've enjoyed it so much, that I thought I'd give it a bit of a write up. Motivation This started out for me with a problem where I had a set of tasks that had to be kicked off at a certain time of day. I have multiple servers that act as workers, any of which could run the task, but I definitely only want one of …

Continue reading »


Effective tests: Setting up a database fixture

Written by Dave Marshall - Published on Dave Marshall's weblog
Aggregated on Monday October 26, 2015 - Permalink

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 the modern frameworks do this kind of thing for you, but here's how I do it. It's …

Continue reading »


Effective tests: Creating test data with fixture factories

Written by Dave Marshall - Published on Dave Marshall's weblog
Aggregated on Wednesday November 11, 2015 - Permalink

Following from my post on setting up a database fixture for your test suite, the next step is adding data to that fixture for your specific tests. The more specific Arrange part of the Arrange, Act, Assert pattern. For a long time, I thought the only way to have database records for my tests, was to manage one large sql dump that contained lots of records, all of which were required for …

Continue reading »


Verifying Doubles in PHP

Written by Dave Marshall - Published on Dave Marshall's weblog
Aggregated on Wednesday April 20, 2016 - Permalink

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 { /* ... */ function bar() { $this->userRepository->delete(123); …

Continue reading »