When you have a bug look up every function you do not understand

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2024-11-21

I had the following in a test

<? php
  $advisor = factory(Advisor::class)->states('withUser')->make();

I briefly thought the call to make() was weird, especially since I used create elsewhere, but didn't investigate this.

An hour of debugging later, I realize the data was never persisted to the goddamn database since make does not save anything (a fact I only realized then)

The fix:

<? php
  $advisor = factory(Advisor::class)->states('withUser')->create();

Lesson

Early in the debugging stage, start looking up the exact meanings of functions you are even slightly unsure about.