public function testModel(TraceInstance $trace) { $instance = $this->getInstance(); if ($instance == null) { $trace->trace(TraceHelper::TRACE_LEVEL_ERROR, "cannot create instance of " . $this->objectName); return false; } $successful = true; foreach ($this->getProperties() as $property) { $successful &= $property->assertObjectProperties($instance, $trace); } return $successful; }
public function assertObjectProperties($object, TraceInstance $trace) { if (!method_exists($object, $this->getSetMethod())) { $trace->trace(TraceHelper::TRACE_LEVEL_ERROR, "Method not defined in class " . get_class($object) . ": " . $this->getSetMethod()); return false; } if (!method_exists($object, $this->getGetMethod())) { $trace->trace(TraceHelper::TRACE_LEVEL_ERROR, "Method not defined in class " . get_class($object) . ": " . $this->getGetMethod()); return false; } return true; }