Skip to content

Commit c94f9a4

Browse files
author
Katalam
committed
Adding a basic test to test the functionality
1 parent 1145e8e commit c94f9a4

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

tests/ExampleTest.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/JsonStructureTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
use Hyperlink\JsonStructure\Actions\DecodeJsonStructure;
4+
5+
test('that the json command returns a valid answer', function () {
6+
$array = [
7+
'key1' => 'value1',
8+
'keys1' => [
9+
'key2' => 'value2',
10+
'key3' => 'value3',
11+
],
12+
'keys2' => [
13+
[
14+
'key4' => 'value4',
15+
'key5' => 'value5',
16+
],
17+
[
18+
'key4' => 'value6',
19+
'key5' => 'value7',
20+
],
21+
],
22+
];
23+
24+
25+
$result = call_user_func(new DecodeJsonStructure($array));
26+
27+
$this->assertEquals($result,
28+
"[
29+
'key1',
30+
'keys1' => [
31+
'key2',
32+
'key3'
33+
],
34+
'keys2' => [
35+
'*' => [
36+
'key4',
37+
'key5'
38+
]
39+
]
40+
]
41+
");
42+
});

0 commit comments

Comments
 (0)