Skip to content

Commit a86b2a0

Browse files
ssheadStephen Shead
andauthored
Added test for float comparison null checks (#33433)
Co-authored-by: Stephen Shead <[email protected]>
1 parent a22ad1f commit a86b2a0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/Database/DatabaseEloquentModelTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ public function testDirtyAttributes()
9191
$this->assertTrue($model->isDirty(['foo', 'bar']));
9292
}
9393

94+
public function testFloatAndNullComparisonWhenDirty()
95+
{
96+
$model = new EloquentModelCastingStub();
97+
$model->floatAttribute = null;
98+
$model->syncOriginal();
99+
$this->assertFalse($model->isDirty('floatAttribute'));
100+
$model->forceFill(['floatAttribute' => 0.0]);
101+
$this->assertTrue($model->isDirty('floatAttribute'));
102+
}
103+
94104
public function testDirtyOnCastOrDateAttributes()
95105
{
96106
$model = new EloquentModelCastingStub;

0 commit comments

Comments
 (0)