예제 #1
0
 /**
  * Test for validations
  */
 public function testRecordValidate()
 {
     $item = new Project_Models_Project(array('db' => $this->sharedFixture));
     $item->title = '';
     $this->assertFalse($item->recordValidate());
     $item->projectId = 1;
     $item->title = 'TEST';
     $item->notes = 'TEST';
     $item->startDate = '1981-05-12';
     $item->endDate = '1981-05-12';
     $item->priority = 1;
     $this->assertTrue($item->recordValidate());
     $item = new Project_Models_Project(array('db' => $this->sharedFixture));
     $result = array(array('field' => 'currentStatus', 'label' => 'Current status', 'message' => 'Value out of range'));
     $item->projectId = 1;
     $item->title = 'TEST';
     $item->notes = 'TEST';
     $item->startDate = '1981-05-12';
     $item->endDate = '1981-05-12';
     $item->priority = 1;
     $item->currentStatus = 10;
     $this->assertFalse($item->recordValidate());
     $this->assertEquals($result, $item->getError());
     $item = new Customized_Project(array('db' => $this->sharedFixture));
     $item->projectId = 1;
     $item->title = 'TEST';
     $item->notes = 'TEST';
     $item->startDate = '1981-05-12';
     $item->endDate = '1981-05-12';
     $item->priority = 0;
     $this->assertFalse($item->recordValidate());
 }