forked from etsy/411
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilTest.php
More file actions
50 lines (44 loc) · 1.18 KB
/
Copy pathUtilTest.php
File metadata and controls
50 lines (44 loc) · 1.18 KB
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
<?php
class UtilTest extends TestCase {
public function getProvider() {
return [
[[], null, null, null],
[[1], 0, null, 1],
[[1], 1, null, null],
[['a' => 1], 'a', null, 1],
[['a' => 1], 'b', null, null],
];
}
/**
* @dataProvider getProvider
*/
public function testGet($arr, $key, $default, $expected) {
$this->assertSame(FOO\Util::get($arr, $key, $default), $expected);
}
public function existsProvider() {
return [
[[], null, false],
[[1], 0, true],
[[1], 1, false],
[['a' => 1], 'a', true],
[['a' => 1], 'b', false],
];
}
/**
* @dataProvider existsProvider
*/
public function testExists($arr, $key, $expected) {
$this->assertSame(FOO\Util::exists($arr, $key), $expected);
}
public function escapeProvider() {
return [
['&<>\'"', '&<>'"'],
];
}
/**
* @dataProvider escapeProvider
*/
public function testEscape($data, $expected) {
$this->assertSame(FOO\Util::escape($data), $expected);
}
}