-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugBarTestCase.php
More file actions
50 lines (40 loc) · 1.25 KB
/
DebugBarTestCase.php
File metadata and controls
50 lines (40 loc) · 1.25 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
declare(strict_types=1);
namespace DebugBar\Bridge\Symfony\Tests;
use DebugBar\Bridge\Symfony\SymfonyHttpDriver;
use DebugBar\DebugBar;
use PHPUnit\Framework\TestCase;
abstract class DebugBarTestCase extends TestCase
{
protected DebugBar $debugbar;
public function setUp(): void
{
$this->debugbar = new DebugBar();
}
public function assertJsonIsArray(string $json): void
{
$data = json_decode($json);
$this->assertIsArray($data);
}
public function assertJsonIsObject(string $json): void
{
$data = json_decode($json);
$this->assertIsObject($data);
}
public function assertJsonArrayNotEmpty(string $json): void
{
$data = json_decode($json, true);
$this->assertTrue(is_array($data) && !empty($data));
}
public function assertJsonHasProperty(string $json, string $property): void
{
$data = json_decode($json, true);
$this->assertArrayHasKey($property, $data);
}
public function assertJsonPropertyEquals(string $json, string $property, mixed $expected): void
{
$data = json_decode($json, true);
$this->assertArrayHasKey($property, $data);
$this->assertEquals($expected, $data[$property]);
}
}