public function getDriver() { return $this->hasOne(tResident::className(), ['id' => 'idDriver']); }
public function testCreateResident() { //simulate form input $post = ['tResident' => ['role' => '2', 'PersonSurname' => 'Ivanov', 'PersonName' => 'Ivan', 'PersonMiddleName' => 'Ivanovich', 'PersonPost' => 'Driver', 'ContactPhone' => '+7878787777', 'sex' => 'male', 'email' => '*****@*****.**']]; $resident = new tResident(); $this->assertTrue($resident->load($post), 'Load resident POST data'); $this->assertTrue($resident->validate(), 'Validate resident'); $this->assertTrue($resident->save(), 'Create resident'); return $resident; }