Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ObjectToArrayConverterTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class ObjectToArrayConverterTest extends \PHPUnit\Framework\TestCase
11 {
12  public function testConvert()
13  {
14  $input = new \stdClass();
15  $input->property = new \stdClass();
16  $input->property2 = 'bla';
17  $input->property->property3 = new \stdClass();
18  $input->property->property4 = 'bla';
19  $input->property->property3->property5 = 'bla';
20 
21  $output = [
22  'property' => [
23  'property3' => [
24  'property5' => 'bla'
25  ],
26  'property4' => 'bla'
27  ],
28  'property2' => 'bla'
29  ];
30 
31  $converter = new ObjectToArrayConverter();
32  static::assertEquals($output, $converter->convert($input));
33  }
34 }