Commit db622f7a authored by Jens Segers's avatar Jens Segers

Tweaked tests

parent 209b3013
...@@ -234,10 +234,10 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase { ...@@ -234,10 +234,10 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
public function testDistinct() public function testDistinct()
{ {
DB::collection('items')->insert(array( DB::collection('items')->insert(array(
array('name' => 'knife', 'type' => 'sharp', 'amount' => 34), array('name' => 'knife', 'type' => 'sharp',),
array('name' => 'fork', 'type' => 'sharp', 'amount' => 20), array('name' => 'fork', 'type' => 'sharp'),
array('name' => 'spoon', 'type' => 'round', 'amount' => 3), array('name' => 'spoon', 'type' => 'round'),
array('name' => 'spoon', 'type' => 'round', 'amount' => 14) array('name' => 'spoon', 'type' => 'round')
)); ));
$items = DB::collection('items')->distinct('name')->get(); $items = DB::collection('items')->distinct('name')->get();
...@@ -260,6 +260,14 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase { ...@@ -260,6 +260,14 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase {
$item = DB::collection('items')->where('_id', 'fork')->first(); $item = DB::collection('items')->where('_id', 'fork')->first();
$this->assertEquals('fork', $item['_id']); $this->assertEquals('fork', $item['_id']);
DB::collection('users')->insert(array(
array('_id' => 1, 'name' => 'Jane Doe'),
array('_id' => 2, 'name' => 'John Doe')
));
$item = DB::collection('users')->find(1);
$this->assertEquals(1, $item['_id']);
} }
public function testTake() public function testTake()
......
...@@ -3,7 +3,7 @@ require_once('tests/app.php'); ...@@ -3,7 +3,7 @@ require_once('tests/app.php');
class QueryTest extends PHPUnit_Framework_TestCase { class QueryTest extends PHPUnit_Framework_TestCase {
public function setUp() public static function setUpBeforeClass()
{ {
// test data // test data
User::create(array('name' => 'John Doe', 'age' => 35, 'title' => 'admin')); User::create(array('name' => 'John Doe', 'age' => 35, 'title' => 'admin'));
...@@ -17,7 +17,7 @@ class QueryTest extends PHPUnit_Framework_TestCase { ...@@ -17,7 +17,7 @@ class QueryTest extends PHPUnit_Framework_TestCase {
User::create(array('name' => 'Error', 'age' => null, 'title' => null)); User::create(array('name' => 'Error', 'age' => null, 'title' => null));
} }
public function tearDown() public static function tearDownAfterClass()
{ {
User::truncate(); User::truncate();
} }
......
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