예제 #1
0
 /**
  * Test special validation that avoids empty association when the type is
  * something meant to be associated, i.e. a logged call, note, etc.
  */
 public function testValidate()
 {
     $action = new Actions();
     $action->type = 'call';
     $action->actionDescription = 'Contacted. Will call back later';
     $this->assertFalse($action->validate());
     $this->assertTrue($action->hasErrors('associationId'));
     $this->assertTrue($action->hasErrors('associationType'));
     // Do the same thing but with "None" association type. Validation should fail.
     $action = new Actions();
     $action->type = 'call';
     $action->associationType = 'None';
     $this->assertFalse($action->validate());
     $this->assertTrue($action->hasErrors('associationId'));
     $this->assertTrue($action->hasErrors('associationType'));
 }