Skip to content

Commit

Permalink
Added simple test to check postgres where operators and fixed other f…
Browse files Browse the repository at this point in the history
…ailed tests
  • Loading branch information
Kiril Grancharov committed Apr 18, 2016
1 parent bd54aee commit 0932c66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ public function orWhere($column, $operator = null, $value = null)
*/
protected function invalidOperatorAndValue($operator, $value)
{
$isOperator = in_array($operator, $this->operators) && in_array($operator, $this->grammar->getOperators());
$isOperator = in_array($operator, $this->operators);

return $isOperator && $operator != '=' && is_null($value);
}
Expand Down
8 changes: 8 additions & 0 deletions tests/Database/DatabaseEloquentBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,14 @@ public function testSimpleWhere()
$this->assertEquals($result, $builder);
}

public function testPostgresOperatorsWhere()
{
$builder = $this->getBuilder();
$builder->getQuery()->shouldReceive('where')->once()->with('foo', '@>', 'bar');
$result = $builder->where('foo', '@>', 'bar');
$this->assertEquals($result, $builder);
}

public function testDeleteOverride()
{
$builder = $this->getBuilder();
Expand Down

0 comments on commit 0932c66

Please sign in to comment.