Project

General

Profile

Download (1.45 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2

    
3
// using namespace to allow for better sorting of test classes in the results
4
namespace test\phpunit\unit;
5

    
6

    
7
use PHPUnit\Framework\TestCase;
8

    
9
// these includes require <includePath>../..</includePath> to be set in phpUnit.xml
10
include 'includes/common.inc';
11
include 'cdm_api/commons.php';
12

    
13
/**
14
 * test to test if phpUnit is ok
15
 * @author a.kohlbecker
16
 *
17
 */
18
class StatisticalValuesTest extends TestCase {
19

    
20
  function new_statistical_value($value = null){
21
    $stat_val = new \stdClass(); // need to use the root namespace
22
    $stat_val->_value = $value;
23
    return $stat_val;
24
  }
25

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

    
35
  function html2text($html){
36
    return  html_entity_decode(strip_tags($html), ENT_COMPAT, 'utf-8');
37
  }
38

    
39
  function test_statistical_values() {
40

    
41
    $stat_vals = $this->create_statistical_values(0.123457,  0.123456, 0.123456523847, 5);
42

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

    
46
}
(1-1/2)