Skip to content

Commit db622f7

Browse files
committed
Tweaked tests
1 parent 209b301 commit db622f7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tests/QueryBuilderTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ public function testPull()
234234
public function testDistinct()
235235
{
236236
DB::collection('items')->insert(array(
237-
array('name' => 'knife', 'type' => 'sharp', 'amount' => 34),
238-
array('name' => 'fork', 'type' => 'sharp', 'amount' => 20),
239-
array('name' => 'spoon', 'type' => 'round', 'amount' => 3),
240-
array('name' => 'spoon', 'type' => 'round', 'amount' => 14)
237+
array('name' => 'knife', 'type' => 'sharp',),
238+
array('name' => 'fork', 'type' => 'sharp'),
239+
array('name' => 'spoon', 'type' => 'round'),
240+
array('name' => 'spoon', 'type' => 'round')
241241
));
242242

243243
$items = DB::collection('items')->distinct('name')->get();
@@ -260,6 +260,14 @@ public function testCustomId()
260260

261261
$item = DB::collection('items')->where('_id', 'fork')->first();
262262
$this->assertEquals('fork', $item['_id']);
263+
264+
DB::collection('users')->insert(array(
265+
array('_id' => 1, 'name' => 'Jane Doe'),
266+
array('_id' => 2, 'name' => 'John Doe')
267+
));
268+
269+
$item = DB::collection('users')->find(1);
270+
$this->assertEquals(1, $item['_id']);
263271
}
264272

265273
public function testTake()

tests/QueryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class QueryTest extends PHPUnit_Framework_TestCase {
55

6-
public function setUp()
6+
public static function setUpBeforeClass()
77
{
88
// test data
99
User::create(array('name' => 'John Doe', 'age' => 35, 'title' => 'admin'));
@@ -17,7 +17,7 @@ public function setUp()
1717
User::create(array('name' => 'Error', 'age' => null, 'title' => null));
1818
}
1919

20-
public function tearDown()
20+
public static function tearDownAfterClass()
2121
{
2222
User::truncate();
2323
}

0 commit comments

Comments
 (0)