Commit 96f07a9f authored by Jens Segers's avatar Jens Segers

Adding tests for #212

parent 79c0fdbc
......@@ -6,7 +6,10 @@ class ConnectionTest extends TestCase {
{
$connection = DB::connection('mongodb');
$this->assertInstanceOf('Jenssegers\Mongodb\Connection', $connection);
}
public function testReconnect()
{
$c1 = DB::connection('mongodb');
$c2 = DB::connection('mongodb');
$this->assertEquals(spl_object_hash($c1), spl_object_hash($c2));
......
......@@ -57,6 +57,20 @@ class RelationsTest extends TestCase {
$role = $user->role;
$this->assertEquals('admin', $role->type);
$this->assertEquals($user->_id, $role->user_id);
$user = User::create(array('name' => 'Jane Doe'));
$role = new Role(array('type' => 'user'));
$user->role()->save($role);
$role = $user->role;
$this->assertEquals('user', $role->type);
$this->assertEquals($user->_id, $role->user_id);
$user = User::where('name', 'Jane Doe')->first();
$role = $user->role;
$this->assertEquals('user', $role->type);
$this->assertEquals($user->_id, $role->user_id);
}
public function testWithBelongsTo()
......
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