Commit 53d286f8 authored by Jens Segers's avatar Jens Segers

Convert operators to lowercase, fixes #156

parent 3a30bf7f
......@@ -673,6 +673,12 @@ class Builder extends \Illuminate\Database\Query\Builder {
foreach ($this->wheres as $i => &$where)
{
// Make sure the operator is in lowercase
if (isset($where['operator']))
{
$where['operator'] = strtolower($where['operator']);
}
// Convert id's
if (isset($where['column']) && $where['column'] == '_id')
{
......
......@@ -517,6 +517,9 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
$regex = new MongoRegex("/.*doe/i");
$results = DB::collection('users')->where('name', 'regex', $regex)->get();
$this->assertEquals(2, count($results));
$results = DB::collection('users')->where('name', 'REGEX', $regex)->get();
$this->assertEquals(2, count($results));
}
public function testIncrement()
......
......@@ -64,6 +64,9 @@ class QueryTest extends PHPUnit_Framework_TestCase {
$users = User::where('name', 'like', '%y%')->get();
$this->assertEquals(3, count($users));
$users = User::where('name', 'LIKE', '%y%')->get();
$this->assertEquals(3, count($users));
$users = User::where('name', 'like', 't%')->get();
$this->assertEquals(1, count($users));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment