-
Notifications
You must be signed in to change notification settings - Fork 7
/
ApprovalTest.php
59 lines (53 loc) · 1.41 KB
/
ApprovalTest.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
53
54
55
56
57
58
59
<?php namespace ApprovalTests\Tests;
use Exception;
use PHPUnit\Framework\TestCase;
use ApprovalTests\Approvals;
use ApprovalTests\Reporters\QuietReporter;
# begin-snippet: array_example
class ApprovalTest extends TestCase
{
public function testVerifyArray()
{
$list = ['zero', 'one', 'two', 'three', 'four', 'five'];
Approvals::verifyList($list);
}
# end-snippet
public function testFailedVerifyArray()
{
$this->expectException(Exception::class);
$list = ['zero', 'one', 'two', 'three', 'four', 'five'];
Approvals::verifyList($list, new QuietReporter());
}
public function testVerifyMap()
{
$list = [
'zero' => 'Lance',
'one' => 'Jim',
'two' => 'James',
'three' => 'LLewellyn',
'four' => 'Asaph',
'five' => 'Dana'
];
Approvals::verifyList($list);
}
public function testVerifyString()
{
$fudge = 'fudge';
Approvals::verifyString($fudge);
}
# begin-snippet: verify_as_json
public function testVerifyAsJson()
{
$obj = [
"color" => "black",
"category" => "hue",
"type" => "primary",
"code" => [
"rgba" => [255, 255, 255, 1],
"hex" => "#000",
]
];
Approvals::verifyAsJson($obj);
}
# end-snippet
}