public function testToArray()
    {
        $object = <<<OBJ
        {
            "multiple": [
                {
                    "val1": "one",
                    "val2": "two"
                },
                {
                    "val3": "three",
                    "val4": [
                        {
                            "val4": "four"
                        }
                    ]
                }
            ],
            "nested": {
                "obj1": {
                    "val1": "one",
                    "val2": "two"
                },
                "obj2": {
                    "val3": "three",
                    "val4": "four"
                }
            }
        }
OBJ;
        $expected = ["multiple" => [["val1" => "one", "val2" => "two"], ["val3" => "three", "val4" => [["val4" => "four"]]]], "nested" => ["obj1" => ["val1" => "one", "val2" => "two"], "obj2" => ["val3" => "three", "val4" => "four"]]];
        $actual = ObjectUtils::toArray($this->toObject($object));
        $this->assertEquals($expected, $actual);
    }
 public function testToArray()
 {
     $object = new stdClass();
     $object->foo = 'bar';
     $object->baz = new stdClass();
     $object->baz->bat = 'bazbat';
     $expected = ObjectUtils::toArray($object);
     $this->trait->setProxy($object);
     $this->assertSame($expected, $this->trait->toArray());
 }
 /**
  * Assert that the resource's relationships contains the provided subset.
  *
  * @param object|array $expected
  * @param string|null $message
  * @return $this
  */
 public function assertRelationshipsSubset($expected, $message = null)
 {
     $expected = ObjectUtils::toArray($expected);
     $actual = ObjectUtils::toArray($this->getRelationships() ?: []);
     $message = $message ? $this->withIndex($message) : $this->withIndex('Unexpected resource relationships') . ': ' . json_encode($actual);
     PHPUnit::assertArraySubset($expected, $actual, $message);
     return $this;
 }
 /**
  * @return array
  */
 public function toArray()
 {
     return ObjectUtils::toArray($this->getProxy());
 }