1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 13:28:35 +01:00
php-debugbar/tests/DebugBar/Tests/DebugBarTestCase.php

50 lines
1.2 KiB
PHP
Raw Normal View History

2013-06-13 18:48:23 +08:00
<?php
namespace DebugBar\Tests;
2013-08-14 22:12:33 +10:00
use DebugBar\DebugBar;
use DebugBar\RandomRequestIdGenerator;
use PHPUnit\Framework\TestCase;
2013-08-14 22:12:33 +10:00
abstract class DebugBarTestCase extends TestCase
2013-06-13 18:48:23 +08:00
{
protected $debugbar;
public function setUp(): void
2013-08-14 22:12:33 +10:00
{
$this->debugbar = new DebugBar();
$this->debugbar->setHttpDriver($http = new MockHttpDriver());
2013-08-14 22:12:33 +10:00
}
2013-08-14 22:22:07 +10:00
public function assertJsonIsArray($json)
{
$data = json_decode($json);
$this->assertIsArray($data);
2013-08-14 22:22:07 +10:00
}
public function assertJsonIsObject($json)
{
$data = json_decode($json);
$this->assertIsObject($data);
2013-08-14 22:22:07 +10:00
}
public function assertJsonArrayNotEmpty($json)
{
$data = json_decode($json, true);
$this->assertTrue(is_array($data) && !empty($data));
}
public function assertJsonHasProperty($json, $property)
{
$data = json_decode($json, true);
$this->assertTrue(array_key_exists($property, $data));
}
public function assertJsonPropertyEquals($json, $property, $expected)
{
$data = json_decode($json, true);
$this->assertTrue(array_key_exists($property, $data));
$this->assertEquals($expected, $data[$property]);
}
2013-06-13 18:48:23 +08:00
}