Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SerializedToJsonTest.php
Go to the documentation of this file.
1 <?php
7 
11 
12 class SerializedToJsonTest extends \PHPUnit\Framework\TestCase
13 {
17  private $serializedToJson;
18 
19  protected function setUp()
20  {
21  $this->serializedToJson = new SerializedToJson(
22  new Serialize(),
23  new Json()
24  );
25  }
26 
34  public function testConvert($serializedData, $expectedJson)
35  {
36  $this->assertEquals($expectedJson, $this->serializedToJson->convert($serializedData));
37  }
38 
44  public function convertDataProvider()
45  {
46  return [
47  1 => ['serializedData' => 'a:1:{i:0;d:0.12345678901234568;}', 'expectedJson' => '[0.12345678901234568]'],
48  2 => ['serializedData' => 'a:1:{i:0;d:2.2029999999999998;}', 'expectedJson' => '[2.2029999999999998]']
49  ];
50  }
51 }