Posts marked with “unit testing”

Laravel: Pest Control

by · May 1, 2022

0
 

PEST is a PHP testing framework built on top of PHPUnit that offers a functional approach to writing tests, eliminating as much boilerplate as possible and focusing on the tests themselves. It was created by Nuno Maduro (Laravel Core Team member) in 2020, and since then, it has had 1.6M downloads. by Marian Pop

 

DDD Alley: Better Late Than Never

by · March 1, 2022

0
 

Last month, we created “role-based lookups” with “When You Know the Pattern.” Database-related code can be difficult to unit test, and once unit tests are written, they can be difficult and time-consuming to maintain. This month we’ll carefully look at this problem and possible solutions. We’ll walk through the test suite after extensive refactoring to […]

 

Sustainable PHP: Testing Business Rule

by · February 8, 2021

0
 

There’s an old joke that runs, “We just got a new project. You two start coding while I go find out the requirements.” This month we talk about evaluating and implementing business rules, thus meeting project requirements. We focus on discerning what’s important and what isn’t, and recognizing interactions that can quickly get out of […]

 

Getting Started With Test-Driven Development

by · July 1, 2020

0
 

As developers, we spend a large portion of our time testing code we’ve just written. In a traditional testing cycle, we write some code and manually test it until it’s error-free, but how do we know it will be error-free a year from now? Embracing Test-Driven Development (TDD) allows us to quickly build a suite […]

 

Education Station: Unit Testing Basics

by · February 6, 2020

0
 

By Chris Tankersley Recently, we’ve discussed principles for writing clean code in your php applications. Testing is a valuable technique to help you produce and maintain a codebase, but it can be daunting to learn. In this article, we’ll start with unit testing. Let’s look at how tests help during the design phase and in […]

 

Education Station: Unit Testing Basics

by · January 3, 2020

0
 

Recently, we’ve discussed principles for writing clean code in your php applications. Testing is a valuable technique to help you produce and maintain a codebase, but it can be daunting to learn. In this article, we’ll start with unit testing. Let’s look at how tests help during the design phase and in maintenance, what unit tests are, and how to use PHPUnit for your test suite.

 

Pragmatic PHP: Testing Singletons

by · October 2, 2019

0
 

This month wraps up our singleton coverage. We’ll see the self registry variant (a self-contained registry pattern implementation). We’ll find ways to test singletons and learn how to test database memoization without requiring an actual database.

 

Easier Mocking with Mockery

by · December 21, 2018

0
 

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 […]

 

Better Practice – December 2018

by · December 11, 2018

0
 

Practice and more practice are the keys to adopting modern software engineering practices. It doesn’t matter if you’re using WordPress or Drupal to manage website content, trying to learn unit testing, get hired, or looking for better ways to manage date and time data—there’s always an opportunity to learn how to do it better. This issue rounds up articles on each of these topics to help you deepen your problem-solving skills.

 

How to Learn PHP Unit Testing With Katas

by ·

0
 

Sometimes code is first tested when the unfortunate client or user feels like using the feature and tests the developer’s work. Hopefully, they’re not disappointed. That’s why you should be interested in unit testing and Test-Driven Development (TDD)—because it makes your life as a programmer better.