Ejemplo n.º 1
0
 /**
  * Get directories tree array
  *
  * @return array
  */
 public function getTreeArray()
 {
     $directories = $this->getDirsCollection($this->_helper->getCurrentPath());
     $resultArray = [];
     foreach ($directories as $path) {
         $resultArray[] = ['text' => $this->_helper->getShortFilename(pathinfo($path, PATHINFO_BASENAME), 20), 'id' => $this->_helper->convertPathToId($path), 'cls' => 'folder'];
     }
     return $resultArray;
 }
Ejemplo n.º 2
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));
 }