Logan Bailey

Adventures In Web Development

Blog, About, GitHub, and LinkedIn

Ramsey UUID and Unit Tests

March 22nd, 2018
Generating Uuids with Ramsey Uuid is damn easy, \Ramsey\Uuid\Uuid::uuid1(). Generating predictable Uuids for testing while not obvious, is not difficult either. In a few simple steps you can replace the default Uuid Factory with a mock factory that will return your specified Uuids .

You're Writing Your Tests Wrong

March 31st, 2017
While preparing for a talk, I realized that I'd been writing unit tests wrong for the last 3 years. I'd always approached test writing iteratively rather than from the outside in. With this one change, I was able to write cleaner more maintainable tests.

PHPUnit Quick Tip - Type Hint Your Mocks

February 6th, 2017
Type hinting your properties, specifically your mock objects, in your tests can go a long way to create a more seamless and developer friendly test suite. For a long time, I suffered through static code analysis errors where I was supplying mocks to my concrete objects. But with these short steps, I solved those problems.

Data Provider Quick Tips

January 11th, 2017
Data providers are a powerful tool that allows the developer to reuse the same test with different input variables. Here are some easy tips that will take your dataProvider to the next level