Skip to content

Commit 198eda0

Browse files
authored
Merge pull request #8 from khepin/failing-wherein
Fix failing wherein
2 parents ab56b1b + 80be9a0 commit 198eda0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Database/EloquentBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ public function whereIn($column, $values, $boolean = 'and', $not = false)
8787
// Add where statement back
8888
$this->query->wheres[] = $where;
8989

90+
// Reset the bindings to the previous value
91+
$this->query->bindings = $bindings;
9092
// Loop over all the mutated values and add the bindings
9193
foreach ($mutatedValues as $value) {
9294
if (! $value instanceof Expression) {
93-
// Reset the bindings to the previous value
94-
$this->query->bindings = $bindings;
9595

9696
// Add the mutated bindings back
9797
$this->addBinding($value, 'where');

tests/Integration/MutatorTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,19 @@ public function test_non_mutated_columns()
8585
$this->assertEquals($id, $p->id);
8686
}
8787

88+
/**
89+
* @group debug
90+
*
91+
* @return void
92+
*/
8893
public function test_where_in()
8994
{
9095
$id = Uuid::uuid1()->toString();
96+
$id2 = Uuid::uuid1()->toString();
9197
$model = (new TestModel())->create(['id' => $id, 'name' => 'A chair']);
92-
$p = $model->whereIn('id', [$id])->first();
93-
$this->assertEquals($id, $p->id);
98+
$model2 = (new TestModel())->create(['id' => $id2, 'name' => 'A table']);
99+
$p = $model->whereIn('id', [$id, $id2])->get();
100+
$this->assertEquals(2, $p->count());
94101
}
95102

96103
public function test_update()

0 commit comments

Comments
 (0)