Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdm-dataportal / modules / cdm_dataportal / test / phpUnit / src / unit / StatisticalValuesTest.php @ 778b241c

History | View | Annotate | Download (1.31 KB)

1
<?php
2
use PHPUnit\Framework\TestCase;
3

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

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

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

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

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

    
34
  function test_statistical_values() {
35

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

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

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