public function deprecated_testModelSaveUpdate() { /* Assertions: * Record exists after select * Record marked dirty after change * Record unmarked dirty after save * Record exists after save * Unsaveable records throw exception on save */ $cls = $this->modelClass; $model = new $cls(); $record = new Dbi_Record($model, $this->mockRecordData()); $this->assertTrue($record->exists(), "{$cls} record 'does not exist' after select"); $primary = $record->model()->primary(); $changed = false; foreach ($record->model()->fields() as $key => $field) { if (!in_array($key, $primary['fields'])) { $record[$key] = 'foobar'; $changed = true; } } $this->assertTrue(!$changed || $record->dirty(), "{$cls} record was not marked dirty after change"); if ($record->saveable()) { $record->save(); $this->assertFalse($record->dirty(), "{$cls} record was still marked dirty after update"); $this->assertTrue($record->exists(), "{$cls} record 'does not exist' after update"); } else { $this->expectException('Exception', 'Saving a record that is not saveable should throw an exception'); $record->save(); } }