public function testCreate() { // Create new processing error associated with a crash report $model = new ProcessingError(); $model->type = ProcessingError::TYPE_CRASH_REPORT_ERROR; $model->srcid = 100; $model->message = 'Some error message'; // srcid is incorrect $this->assertFalse($model->validate()); // Set correct srcid $model->srcid = 1; $saved = $model->save(); // Ensure created ok $this->assertTrue($saved); // Find created model $model = ProcessingError::model()->find('message="Some error message"'); $this->assertTrue($model != null); // Create new processing error associated with a debug info $model = new ProcessingError(); $model->type = ProcessingError::TYPE_DEBUG_INFO_ERROR; $model->srcid = 100; $model->message = 'Error message'; // srcid is incorrect $this->assertFalse($model->validate()); // Set correct srcid $model->srcid = 1; $saved = $model->save(); // Ensure created ok $this->assertTrue($saved); }
/** * Returns the list of processing errors associated with this crash report. */ public function getProcessingErrors() { $criteria = new CDbCriteria(); $criteria->compare('srcid', $this->id); $criteria->compare('type', ProcessingError::TYPE_CRASH_REPORT_ERROR); $models = ProcessingError::model()->findAll($criteria); return $models; }