@stanleypeters Just a quick opinion.
Why do we need to predefined data in db for testing?
The main idea for testing to define test environment (in the arrange/given section) for every single test. Supporting this statement, to me, if we follow AAA or Given-when-then approach, we should define the arrange section for every test, no matter what.
For example:
use RefreshDatabase; // This will ensure your database remains untouched after tests
/** @test */
public function a_post_can_be_created()
{
// Arrange
$postData = [
'title' => 'Sample Post',
'content' => 'This is the content of the sample post.'
];
// Act
$post = Post::create($postData);
// Assert
$this->assertDatabaseHas('posts', $postData);
$this->assertEquals($postData['title'], $post->title);
$this->assertEquals($postData['content'], $post->content);
}
ℹ️ Arguably, I might be wrong. But this is my understanding about test.