Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdm-dataportal / modules / cdm_dataportal / test / phpUnit / src / unit / StatisticalValuesTest.php @ 458948d0

History | View | Annotate | Download (1.31 KB)

1
<?php
2

    
3
use PHPUnit\Framework\TestCase;
4

    
5
// these includes require <includePath>../..</includePath> to be set in phpUnit.xml
6
include 'includes/common.inc';
7
include 'cdm_api/commons.php';
8

    
9
/**
10
 * test to test if phpUnit is ok
11
 * @author a.kohlbecker
12
 *
13
 */
14
class StatisticalValuesTest extends TestCase {
15

    
16
  function new_statistical_value($value = null){
17
    $stat_val = new stdClass();
18
    $stat_val->_value = $value;
19
    return $stat_val;
20
  }
21

    
22
  function create_statistical_values($typicalLowerBoundary = null, $typicalUpperrBoundary = null, $average  = null, $sampleSize = null){
23
    $stat_vals = statistical_values_array();
24
    $stat_vals['TypicalLowerBoundary'] = $this->new_statistical_value($typicalLowerBoundary);
25
    $stat_vals['TypicalUpperBoundary'] = $this->new_statistical_value($typicalUpperrBoundary);
26
    $stat_vals['SampleSize'] = $this->new_statistical_value($sampleSize);
27
    $stat_vals['Average'] = $this->new_statistical_value($average);
28
    return $stat_vals;
29
  }
30

    
31
  function html2text($html){
32
    return  html_entity_decode(strip_tags($html), ENT_COMPAT, 'utf-8');
33
  }
34

    
35
  function test_statistical_values() {
36

    
37
    $stat_vals = $this->create_statistical_values(0.123457,  0.123456, 0.123456523847, 5);
38

    
39
    $this->assertEquals('0.123457–0.123456[5;x̄=0.1234565]', $this->html2text(statistical_values($stat_vals)));
40
  }
41

    
42
}
Add picture from clipboard (Maximum size: 40 MB)