public function testFindLazy()
 {
     /* @var $customer Customer */
     $customer = Customer::findOne(['status' => 2]);
     $this->assertFalse($customer->isRelationPopulated('file'));
     $file = $customer->file;
     $this->assertTrue($customer->isRelationPopulated('file'));
     $this->assertTrue($file instanceof CustomerFile);
     $this->assertEquals((string) $file->_id, (string) $customer->file_id);
     $this->assertEquals(1, count($customer->relatedRecords));
 }
 /**
  * @depends testUpdate
  */
 public function testUpdateNestedAttribute()
 {
     $record = new Customer();
     $record->name = 'new name';
     $record->email = 'new email';
     $record->address = ['city' => 'SomeCity', 'street' => 'SomeStreet'];
     $record->status = 7;
     $record->save();
     // save
     $record = Customer::findOne($record->_id);
     $newAddress = ['city' => 'AnotherCity'];
     $record->address = $newAddress;
     $record->save();
     $record2 = Customer::findOne($record->_id);
     $this->assertEquals($newAddress, $record2->address);
 }