public function testGetRemoteJoinField() { $company = new DataObjectTest_Company(); $this->assertEquals('CurrentCompanyID', $company->getRemoteJoinField('CurrentStaff')); $this->assertEquals('PreviousCompanyID', $company->getRemoteJoinField('PreviousStaff')); $ceo = new DataObjectTest_CEO(); $this->assertEquals('CEOID', $ceo->getRemoteJoinField('Company', 'belongs_to')); $this->assertEquals('PreviousCEOID', $ceo->getRemoteJoinField('PreviousCompany', 'belongs_to')); }
public function testGetRemoteJoinField() { $company = new DataObjectTest_Company(); $staffJoinField = $company->getRemoteJoinField('CurrentStaff', 'has_many', $polymorphic); $this->assertEquals('CurrentCompanyID', $staffJoinField); $this->assertFalse($polymorphic, 'DataObjectTest_Company->CurrentStaff is not polymorphic'); $previousStaffJoinField = $company->getRemoteJoinField('PreviousStaff', 'has_many', $polymorphic); $this->assertEquals('PreviousCompanyID', $previousStaffJoinField); $this->assertFalse($polymorphic, 'DataObjectTest_Company->PreviousStaff is not polymorphic'); $ceo = new DataObjectTest_CEO(); $this->assertEquals('CEOID', $ceo->getRemoteJoinField('Company', 'belongs_to', $polymorphic)); $this->assertFalse($polymorphic, 'DataObjectTest_CEO->Company is not polymorphic'); $this->assertEquals('PreviousCEOID', $ceo->getRemoteJoinField('PreviousCompany', 'belongs_to', $polymorphic)); $this->assertFalse($polymorphic, 'DataObjectTest_CEO->PreviousCompany is not polymorphic'); $team = new DataObjectTest_Team(); $this->assertEquals('Favourite', $team->getRemoteJoinField('Fans', 'has_many', $polymorphic)); $this->assertTrue($polymorphic, 'DataObjectTest_Team->Fans is polymorphic'); $this->assertEquals('TeamID', $team->getRemoteJoinField('Comments', 'has_many', $polymorphic)); $this->assertFalse($polymorphic, 'DataObjectTest_Team->Comments is not polymorphic'); }