php[architect] logo

Want to check out an issue? Sign up to receive a special offer.

Testing in Practice – April 2018

Improve Automated Testing.

You can get pretty far without automated testing of your code. I should know, I was slow in adopting it as part of my day to day workflow. The truth is, automated testing ends up speeding up your workflow and its an investment. When you can have a computer, which is built to do routine and repetitive tasks, go through a test suite of dozens to hundreds of tests, you’ll know if your code works and, just as important, does not introduce any unwanted side effects. In this issue, I’ve collected articles to improve your automated testing.

Sponsored By
Nexcess Logo

PHPUnit Worst Practices

By Victor Bolshov

I’ve been working with PHPUnit a lot, probably since 2007. Unit testing and automatic testing in general is important, and it becomes even more important when it comes to team play. Unfortunately, in different teams that I have worked in, I often observed a situation when tests don’t receive all the attention they deserve, sometimes way too little attention. In this article I’m gonna cover certain things that you should avoid in your tests, the mistakes that are still often made even by experienced developers.

Easier Mocking with Mockery

By Robert Basic

Mockery tries to provide an easy to read and understand API, which is also versatile enough, so any scenario that might come up when working with mock objects in our test cases are covered. In this first part, we’ll see how Mockery can be used to create different test doubles and how they fit into a test suite.

Testing Strategy With the Help of Static Analysis

By Ondrej Mirtes

When developing an application, our aim as software developers is to make sure it does what it ought to do and to keep the number of defects as low as possible. We should also strive to make our lives easier, to counter external circumstances like tight deadlines and ever-changing requirements causing the exact opposite. That’s why we’re always looking out for tools and practices to help us with our jobs. In this article, I’d like to introduce you to the concept of type safety and how it can improve the reliability and stability of your code.

Artisinal: Authentication with Laravel

By Joe Ferguson

Authentication is the foundation of your application’s security. Authentication separates guests from users and restricts functionality in your application to authenticated users. We can also take authentication a step further and completely offload the grunt work to some other service such a GitHub, Google, or any other third party authentication service provider.

The Dev Lead Trenches: Ongoing Education

By Chris Tankersley

As a development lead, one of the best things you can do for your team is encouraging and fostering an environment of ongoing learning. There is an entire world of developers out there who stagnate in their jobs because they don’t learn anything new. It does not have to be a whole new language, but every developer should be learning constantly. There are a few ways you can help with this.

Education Station: Build an API, Part One

By Edward Barnard

In this series, we look at using Behavior-Driven Development (BDD) and specification by example to develop a RESTful API with JSON-formatted request and response. In Part One we introduce these concepts, design our database, and implement a minimal working API.

Security Corner: PHP Isolation in Production

By Eric Mann

Developers the world over were in shock this past May as thousands of computers in the UK’s National Health System were rendered inoperable due to a malware attack. Thanks to a previously leaked vulnerability in Windows’ operating system, and the notoriously slow rate at which large enterprises apply system patches, hackers were able to infiltrate and infect these systems with specific viruses.

Community Corner: What’s the Fuss About Serverless?

By James Titcumb

The new kid on the block is this “serverless” technology. But what’s the fuss about? This new concept seems intriguing if only for the name, and has perhaps even garnered skepticism because of the name. I’m sure you’ve heard the joke “there is no cloud, it’s just someone else’s computer” before, but serverless appears to take this one step further by eliminating the server altogether. Jokes aside, there are, of course, servers somewhere in the stack, but the goal of serverless computing is to take the concern of servers out of the mix when developing applications. This frees developers up to think about the application side of things and worry less about the platform on which the code runs.

finally{}: On the Creativity of Programmers

By Eli White

Throughout my career, I regularly got frustrated with many managers (and subsequently the companies) for which I worked. This became a recurring theme and led to me bouncing between dozens of jobs over a relatively short period. I could never quite put the finger on exactly what the problem was, but I just kept getting frustrated at not feeling like I had any say in the software that we were creating, nor that I was considered part of “the team.”

Evolved PHP

By Chris Pitt

Last time, we looked at how to go about adding our own syntax to PHP. We explored a range of options; from submitting to the core project, to using preprocessor macros. We looked at a few uses for custom syntax and even created a silly little Minecraft DSL compiler.

Leave a comment

Use the form below to leave a comment: