コード例 #1
0
 /**
  * @covers \Magento\Theme\Helper\Storage::convertPathToId
  * @covers \Magento\Theme\Helper\Storage::convertIdToPath
  */
 public function testConvertPathToIdAndIdToPath()
 {
     $path = '/image/path/to';
     $this->urlEncoder->expects($this->once())->method('encode')->with('/path/to')->willReturnCallback(function ($path) {
         return base64_encode($path);
     });
     $this->urlDecoder->expects($this->once())->method('decode')->with(base64_encode('/path/to'))->willReturnCallback(function ($path) {
         return base64_decode($path);
     });
     $value = $this->helper->convertPathToId($path);
     $this->assertEquals(base64_encode('/path/to'), $value);
     $this->assertEquals($path, $this->helper->convertIdToPath($value));
 }