/** * 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(); }
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); }
public function testIsFullyGuarded() { $profile = new Profile(); $this->assertFalse($this->object->isFullyGuarded()); $this->assertTrue($profile->isFullyGuarded()); }