-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathReportTest.php
52 lines (45 loc) · 1.55 KB
/
ReportTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use Scientist\Result;
use Scientist\Report;
class ReportTest extends \PHPUnit\Framework\TestCase
{
public function test_that_report_can_be_created()
{
$r = new Result;
$rep = new Report('foo', $r, []);
$this->assertInstanceOf(Report::class, $rep);
}
public function test_that_report_can_hold_experiment_name()
{
$r = new Result;
$rp = new Report('foo', $r, []);
$this->assertEquals('foo', $rp->getName());
}
public function test_that_report_can_hold_control_result()
{
$r = new Result;
$rp = new Report('foo', $r, []);
$this->assertInstanceOf(Result::class, $rp->getControl());
$this->assertSame($r, $rp->getControl());
}
public function test_that_report_can_hold_trial_result()
{
$r = new Result;
$rp = new Report('foo', $r, ['bar' => $r]);
$this->assertInstanceOf(Result::class, $rp->getTrial('bar'));
$this->assertSame($r, $rp->getTrial('bar'));
}
public function test_that_report_can_hold_multiple_trial_results()
{
$r = new Result;
$rp = new Report('foo', $r, ['bar' => $r, 'baz' => $r]);
$this->assertInstanceOf(Result::class, $rp->getTrial('bar'));
$this->assertInstanceOf(Result::class, $rp->getTrial('baz'));
$this->assertSame($r, $rp->getTrial('bar'));
$this->assertSame($r, $rp->getTrial('baz'));
$this->assertCount(2, $rp->getTrials());
$this->assertEquals([
'bar' => $r, 'baz' => $r
], $rp->getTrials());
}
}