Performance: Unit tests
LOW IMPACT
Unit tests affect development speed and feedback loop but do not directly impact page load or rendering performance.
<?php
public function testUserCreation() {
$user = User::factory()->make(['name' => 'Test']);
$this->assertEquals('Test', $user->name);
}
<?php
public function testUserCreation() {
$user = User::create(['name' => 'Test']);
$this->assertDatabaseHas('users', ['name' => 'Test']);
sleep(5); // artificial delay
}
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Unit tests with database I/O and delays | 0 | 0 | 0 | [X] Bad |
| Unit tests using in-memory model factories | 0 | 0 | 0 | [OK] Good |