Exemple #1
0
<?php

/**
 *
 * @author hollodotme
 */
namespace hollodotme\Utilities;

error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once __DIR__ . '/../ArrayConverter.php';
$arr = ['unit', 'test' => 'test', 'unit' => [1 => 'unit', 2 => 'test'], 'empty' => []];
$converter = new ArrayConverter($arr);
$std = $converter->toStdClass();
echo '<pre>', htmlspecialchars(print_r($std, 1)), '</pre>';
Exemple #2
0
 /**
  * @test
  * @dataProvider deserializeProvider
  * @param array $serialized
  * @param string $type
  * @param mixed $expected
  */
 public function deserializeReconstructsValue(array $serialized, string $type = null, $expected)
 {
     $converter = new ArrayConverter();
     $actual = $converter->arrayToObject($serialized, $type);
     self::assertEquals($expected, $actual);
 }