Ejemplo n.º 1
0
 /**
  * Setup the DB once, not before every test.
  */
 public static function setUpBeforeClass()
 {
     Database::registry()->addDriver('default', new MongoDriver(Config::get('db')));
     // Remove singletons
     User::flushInstances();
     Book::flushInstances();
     Series::flushInstances();
     Profile::flushInstances();
 }
Ejemplo n.º 2
0
 public function testDeleteWithOneToOne()
 {
     $this->loadFixtures(['Users', 'Profiles']);
     $user = User::select()->with('Profile')->where('id', 1)->first();
     $this->assertEquals(new User(['id' => 1, 'country_id' => 1, 'username' => 'miles', 'firstName' => 'Miles', 'lastName' => 'Johnson', 'password' => '1Z5895jf72yL77h', 'email' => '*****@*****.**', 'age' => 25, 'created' => '1988-02-26 21:22:34', 'modified' => null, 'Profile' => new Profile(['id' => 4, 'user_id' => 1, 'lastLogin' => '2012-02-15 21:22:34', 'currentLogin' => '2013-06-06 19:11:03'])]), $user);
     $this->assertEquals(1, $user->delete());
     $user = User::find(1);
     $this->assertFalse($user->exists());
     $profile = Profile::find(4);
     $this->assertEquals(new Profile(['id' => 4, 'user_id' => null, 'lastLogin' => '2012-02-15 21:22:34', 'currentLogin' => '2013-06-06 19:11:03']), $profile);
 }
Ejemplo n.º 3
0
 public function testIsFullyGuarded()
 {
     $profile = new Profile();
     $this->assertFalse($this->object->isFullyGuarded());
     $this->assertTrue($profile->isFullyGuarded());
 }