Skip to content

Commit

Permalink
README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
andreypostal committed Aug 17, 2024
1 parent 4282d2c commit e3a378f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Json Handler

[![Coverage Status](https://coveralls.io/repos/github/andreypostal/json-handler-php/badge.svg)](https://coveralls.io/github/andreypostal/json-handler-php) [![Maintainability](https://api.codeclimate.com/v1/badges/63e35ff0220f02d024b9/maintainability)](https://codeclimate.com/github/andreypostal/json-handler-php/maintainability)

Just a light and simple JSON helper that will make it easy for you to deal with json and objects.

3 changes: 3 additions & 0 deletions tests/HydratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

use Andrey\JsonHandler\JsonHandler;
use Andrey\JsonHandler\JsonHydratorTrait;
use Andrey\JsonHandler\JsonItemAttribute;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversMethod;
use PHPUnit\Framework\Attributes\CoversTrait;
use PHPUnit\Framework\TestCase;

#[CoversTrait(JsonHydratorTrait::class)]
#[CoversMethod(JsonHandler::class, 'Decode')]
#[CoversClass(JsonItemAttribute::class)]
final class HydratorTest extends TestCase
{
/**
Expand Down
15 changes: 3 additions & 12 deletions tests/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,22 @@
use Andrey\JsonHandler\JsonHandler;
use Andrey\JsonHandler\JsonItemAttribute;
use Andrey\JsonHandler\JsonSerializerTrait;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversMethod;
use PHPUnit\Framework\Attributes\CoversTrait;
use PHPUnit\Framework\TestCase;

#[CoversTrait(JsonSerializerTrait::class)]
#[CoversMethod(JsonHandler::class, 'Encode')]
#[CoversClass(JsonItemAttribute::class)]
final class SerializerTest extends TestCase
{
/**
* @throws JsonException
*/
public function testSimpleSerialize(): void
{
$obj = new class {
#[JsonItemAttribute]
public string $string = 'string';
#[JsonItemAttribute]
public int $int = 11;
#[JsonItemAttribute]
public float $float = 11.50;
#[JsonItemAttribute]
public bool $bool = true;
};
$obj = new SimpleTestObject();

$handler = new JsonHandler();
$arr = $handler->serialize($obj);
Expand Down Expand Up @@ -88,7 +81,6 @@ public function testSerializeWithKeyModified(): void
*/
public function testSerializeMultiLevel(): void
{

$obj = new WithChildObject();

$handler = new JsonHandler();
Expand All @@ -111,7 +103,6 @@ public function testSerializeMultiLevel(): void
*/
public function testSerializeWithExtraItems(): void
{

$obj = new class {
public string $string = 'string';
#[JsonItemAttribute(key: 'my_item')]
Expand Down

0 comments on commit e3a378f

Please sign in to comment.