Ejemplo n.º 1
0
 public function testSuccessfulQueryWithTMI()
 {
     $model = new TestModel();
     $model->title = 'Title';
     $model->description = 'Desc';
     $model->value = 'Value';
     $model->Insert();
     $model = new TestModel(1);
     $model->title = 'Title2';
     $model->Update();
     $data = $model->Fetch();
     $this->assertEquals('Title2', $data->title);
 }
Ejemplo n.º 2
0
 public function testInvalidUpdate()
 {
     $record = new TestModel();
     $record->SetFrom(array('title' => 'Moo', 'description' => 'foo'));
     $record->Insert();
     $data = new Dictionary('model', 'test_model', 'action', data\ValidatingModelTask::ACTION_UPDATE, 'data', array('id' => $record->id, 'title' => 'bar', 'description' => 'baz'));
     ValidatingTestModelValidator::$validate_description_generates_error = TRUE;
     $task = new data\ValidatingModelTask($data);
     TaskPump::Pump()->RunTask($task);
     $this->assertNotEquals(0, $task->code());
     $errors = $task->errors();
     $this->assertEquals(1, count($errors));
     $this->assertEquals(1, count($errors['description']));
     $this->assertNull($task->record());
     $actual = $record->Fetch();
     $this->assertEquals($record->id, $actual->id);
     $this->assertEquals($record->title, $actual->title);
     $this->assertEquals($record->description, $actual->description);
 }