igmenezes / concerto-platform

Automatically exported from code.google.com/p/concerto-platform
0 stars 0 forks source link

Test Input Parameters get lost #54

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a test and add multiple test input parameters
2. inspect the different paramameter objects
3. only the first parameter is available

What is the expected output? What do you see instead?

Every parameter value should be assignend to its respective object.

What version of the product are you using? On what operating system?
concerto 4.0.0.beta6b
R version 3.0.1 (2013-05-16) -- "Good Sport"
PHP 5.3.10-1ubuntu3.7 with Suhosin-Patch (cli) (built: Jul 15 2013 18:05:44)

Original issue reported on code.google.com by Sebastia...@gmail.com on 6 Sep 2013 at 6:46

GoogleCodeExporter commented 8 years ago
The problem was the verified_input_values function in Test.php, which only 
returns the first parameter.

This code solves the problem:

    public function verified_input_values($values) {
        $result = array();
        $params = $this->get_parameter_TestVariables();

        #create an associative array with parameter names as key
        $phpvals = array();
        foreach ($values as $v) {
                  $vd = json_decode($v);
                  $phpvals[$vd->name] = $v;                
        }                       

        # create array of allowed parameters
        $allowed = array();
        foreach ($params as $param) {
                array_push($allowed, $param->name);
        }

        # filter by allowed values and remove key names
        $result = array_values(array_intersect_key($phpvals, array_flip($allowed)));

        return $result;
    }

Original comment by Sebastia...@gmail.com on 8 Sep 2013 at 12:59

GoogleCodeExporter commented 8 years ago
Fixed in beta7.

Original comment by LisPrzem...@gmail.com on 9 Sep 2013 at 12:53