Are you writing tests to test if your app works correctly or do you only need to check inside the code if a timestamp column has a value ?
Check if timestamp column has value
Hi all, I'm trying to test if a specific column in a table was filled after I did a specific operation.
I have a archived_at timestamp column that will be filled when user accessed the archived API. Now, I'm creating a test case to check if this column is filled. Since this is a timestamp, I don't know the actual data that was saved in the database. Hence, assertDatabaseHas always fails.
For now what I'm doing is just refresh the model I got using $model->refresh() and using the data from there to compare it in assertDatabaseHas. Not sure if this is the best approach of it.
Really appreciate your suggestions.
UPDATE:
What I just did was $this->assertNotNull($model->transaction_date)
Please or to participate in this conversation.