Inheritance: extends PHPUnit_Framework_TestCase
function test_row(ValidationTest $test, $indentation, TableCreator $table_creator)
{
    $test->with('test', 'requirement', 'children');
    $ret = "";
    $ret .= $table_creator->row(array($table_creator->child_indentation($indentation), $test->public_id(), $test->test->description, $test->requirement == null ? '' : $test->requirement->public_id(), 'success'));
    $nested = $test->children;
    foreach ($nested as $c) {
        $ret .= test_row($c, $indentation + 1, $table_creator);
    }
    return $ret;
}
Exemplo n.º 2
0
function test_row(ValidationTest $test, TableCreator $table_creator)
{
    $test->with('children');
    if (!isset($test->children) || count($test->children) == 0) {
        return "";
    }
    $str = "\nAll'utente è richiesto di:\n";
    $str .= $table_creator->begin_list();
    foreach ($test->children as $child) {
        $child->with('test');
        $id = $child->public_id();
        $str .= $table_creator->list_item($table_creator->anchor($id, $child->test->description . " ({$id})"));
        $str .= test_row($child, $table_creator);
    }
    $str .= $table_creator->end_list();
    return $str;
}
Exemplo n.º 3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Test();
     $special = null;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Test']) && isset($_POST['test_type'])) {
         $model->attributes = $_POST['Test'];
         switch ($_POST['test_type']) {
             case 'System':
                 $special = new SystemTest();
                 $special->attributes = $_POST['SystemTest'];
                 break;
             case 'Unit':
                 $special = new UnitTest();
                 $special->attributes = $_POST['UnitTest'];
                 break;
             case 'Integration':
                 $special = new IntegrationTest();
                 $special->attributes = $_POST['IntegrationTest'];
                 break;
             case 'Validation':
                 $special = new ValidationTest();
                 $special->attributes = $_POST['Vali tionTest'];
                 break;
         }
         if ($special != null) {
             $special->id_test = 0;
             if ($special->validate()) {
                 if ($model->save()) {
                     $special->id_test = $model->id_test;
                     $special->save(false);
                     $this->redirect(array('view', 'id' => $model->id_test));
                 }
             }
         }
     }
     $this->render('create', array('model' => $model, 'special' => $special));
 }