-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLoadJsonObjectHttpTest.php
More file actions
41 lines (29 loc) · 1.1 KB
/
LoadJsonObjectHttpTest.php
File metadata and controls
41 lines (29 loc) · 1.1 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
<?php
use PHPUnit\Framework\TestCase;
use HiFolks\DataType\Block;
class LoadJsonObjectHttpTest extends TestCase
{
public function testLoadJsonObjectHttp(): void
{
$jsonString = file_get_contents(__DIR__ . "/../data/story.json");
$composerContent = Block::fromJsonString($jsonString);
$this->assertSame("Home", $composerContent->get("story.name"));
$this->assertInstanceOf(
Block::class,
$composerContent->getBlock("story.content"),
);
$this->assertArrayHasKey(
"body",
$composerContent->get("story.content"),
);
$bodyComponents = $composerContent->getBlock("story.content.body");
$this->assertCount(10, $bodyComponents);
$this->assertSame("New banner", $bodyComponents->get("0.headline"));
$this->assertSame("Hello Everyone", $bodyComponents->get("1.headline"));
$this->assertSame(
"We don't know what we don't know.",
$bodyComponents->get("2.headline"),
);
$this->assertSame(1717763755, $composerContent->get("cv"));
}
}