Skip to content

Commit 0085687

Browse files
committed
IHF: get_dump tests added.
1 parent f5a2755 commit 0085687

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/dump/GetDumpTest.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
class GetDumpTest extends TestCase
4+
{
5+
/** @test */
6+
public function it_correctly_dumps_null()
7+
{
8+
$this->assertEquals("null\n", get_dump(null));
9+
}
10+
11+
/** @test */
12+
public function it_correctly_dumps_boolean_true()
13+
{
14+
$this->assertEquals("true\n", get_dump(true));
15+
}
16+
17+
/** @test */
18+
public function it_correctly_dumps_boolean_false()
19+
{
20+
$this->assertEquals("false\n", get_dump(false));
21+
}
22+
23+
/** @test */
24+
public function it_correctly_dumps_integer()
25+
{
26+
$this->assertEquals("123\n", get_dump(123));
27+
}
28+
29+
/** @test */
30+
public function it_correctly_dumps_float()
31+
{
32+
$this->assertEquals("123.45\n", get_dump(123.45));
33+
}
34+
35+
/** @test */
36+
public function it_correctly_dumps_string()
37+
{
38+
$this->assertEquals("\"some string to dump\"\n", get_dump('some string to dump'));
39+
}
40+
41+
/** @test */
42+
public function it_correctly_dumps_array()
43+
{
44+
$array = [
45+
'a simple string' => 'in an array of 5 elements',
46+
'a float' => 1.0,
47+
'an integer' => 1,
48+
'a boolean' => true,
49+
'an empty array' => [],
50+
];
51+
52+
$expected = "array:5 [\n"
53+
. " \"a simple string\" => \"in an array of 5 elements\"\n"
54+
. " \"a float\" => 1.0\n"
55+
. " \"an integer\" => 1\n"
56+
. " \"a boolean\" => true\n"
57+
. " \"an empty array\" => []\n"
58+
. "]\n"
59+
;
60+
61+
$this->assertEquals($expected, get_dump($array));
62+
}
63+
}

0 commit comments

Comments
 (0)