Skip to content

Commit 40b16e3

Browse files
committed
Adding <> to queries and extra tests
1 parent e23241d commit 40b16e3

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/Jenssegers/Mongodb/Builder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Builder extends \Illuminate\Database\Query\Builder {
2020
protected $conversion = array(
2121
'=' => '=',
2222
'!=' => '$ne',
23+
'<>' => '$ne',
2324
'<' => '$lt',
2425
'<=' => '$lte',
2526
'>' => '$gt',

tests/ModelTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testUpdate()
6666
$check->save();
6767

6868
$this->assertEquals(true, $check->exists);
69-
$this->assertInstanceOf('DateTime', $user->created_at);
69+
$this->assertInstanceOf('DateTime', $check->created_at);
7070
$this->assertInstanceOf('DateTime', $check->updated_at);
7171
$this->assertEquals(1, User::count());
7272

@@ -185,7 +185,6 @@ public function testSoftDelete()
185185
$this->assertEquals(true, $user->exists);
186186

187187
$user->delete();
188-
$this->assertEquals(false, $user->exists);
189188

190189
$check = Soft::find($user->_id);
191190
$this->assertEquals(null, $check);
@@ -195,6 +194,14 @@ public function testSoftDelete()
195194

196195
$all = Soft::withTrashed()->get();
197196
$this->assertEquals(1, $all->count());
197+
198+
$check = $all[0];
199+
$this->assertInstanceOf('DateTime', $check->deleted_at);
200+
$this->assertEquals(true, $check->trashed());
201+
202+
$check->restore();
203+
$all = Soft::get();
204+
$this->assertEquals(1, $all->count());
198205
}
199206

200207
}

tests/QueryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function testWhere()
6161

6262
$users = User::where('age', '!=', 35)->get();
6363
$this->assertEquals(6, count($users));
64+
65+
$users = User::where('age', '<>', 35)->get();
66+
$this->assertEquals(6, count($users));
6467
}
6568

6669
public function testAndWhere()

0 commit comments

Comments
 (0)