Skip to content

Commit

Permalink
[5.3] Remove the condition from updateOrInsert since it's added alrea…
Browse files Browse the repository at this point in the history
…dy (#15540)

* Remove the condition from updateOrInsert since it's added already

*    fix test
  • Loading branch information
themsaid authored and taylorotwell committed Sep 21, 2016
1 parent 42e09d2 commit d145a84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@ public function updateOrInsert(array $attributes, array $values = [])
return $this->insert(array_merge($attributes, $values));
}

return (bool) $this->where($attributes)->take(1)->update($values);
return (bool) $this->take(1)->update($values);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ public function testUpdateOrInsertMethod()
m::mock('Illuminate\Database\Query\Processors\Processor'),
]);

$builder->shouldReceive('where')->twice()->with(['email' => 'foo'])->andReturn(m::self());
$builder->shouldReceive('where')->once()->with(['email' => 'foo'])->andReturn(m::self());
$builder->shouldReceive('exists')->once()->andReturn(true);
$builder->shouldReceive('take')->andReturnSelf();
$builder->shouldReceive('update')->once()->with(['name' => 'bar'])->andReturn(1);
Expand Down

0 comments on commit d145a84

Please sign in to comment.