Skip to content

Commit 8bad4ea

Browse files
committed
Added tests for initial as well as incremental negative values
1 parent 3127b88 commit 8bad4ea

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

tests/system/Database/Live/IncrementTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ public function testIncrementManyWithNegativeValue(): void
100100
$this->seeInDatabase('job', ['name' => 'job1', 'description' => '8', 'created_at' => 0]);
101101
}
102102

103+
public function testIncrementManyWithInitialAndIncrementNegativeValues(): void
104+
{
105+
$this->hasInDatabase('job', ['name' => 'job2', 'description' => '10', 'created_at' => -1]);
106+
107+
$this->db->table('job')
108+
->where('name', 'job2')
109+
->incrementMany(['description' => 2, 'created_at' => -3]);
110+
111+
$this->seeInDatabase('job', ['name' => 'job2', 'description' => '12', 'created_at' => -4]);
112+
}
113+
103114
public function testIncrementManyWithEmptyColumns(): void
104115
{
105116
$this->hasInDatabase('job', ['name' => 'job1', 'description' => '6', 'created_at' => 1]);
@@ -196,7 +207,7 @@ public function testDecrementManyWithValue(): void
196207
$this->seeInDatabase('job', ['name' => 'job1', 'description' => '4', 'created_at' => -1]);
197208
}
198209

199-
public function testDecrementManyWithNegativeValues(): void
210+
public function testDecrementManyWithNegativeValue(): void
200211
{
201212
$this->hasInDatabase('job', ['name' => 'job1', 'description' => '6', 'created_at' => 1]);
202213

@@ -207,6 +218,17 @@ public function testDecrementManyWithNegativeValues(): void
207218
$this->seeInDatabase('job', ['name' => 'job1', 'description' => '4', 'created_at' => 2]);
208219
}
209220

221+
public function testDecrementManyWithInitialAndIncrementNegativeValues(): void
222+
{
223+
$this->hasInDatabase('job', ['name' => 'job2', 'description' => '10', 'created_at' => -1]);
224+
225+
$this->db->table('job')
226+
->where('name', 'job2')
227+
->decrementMany(['description' => 2, 'created_at' => -3]);
228+
229+
$this->seeInDatabase('job', ['name' => 'job2', 'description' => '8', 'created_at' => 2]);
230+
}
231+
210232
public function testDecrementManyWithEmptyColumns(): void
211233
{
212234
$this->hasInDatabase('job', ['name' => 'job1', 'description' => '6', 'created_at' => 1]);

0 commit comments

Comments
 (0)