/** * 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; }
/** * @covers \Magento\Theme\Helper\Storage::getShortFilename * @covers \Magento\Theme\Helper\Storage::__construct */ public function testGetShortFilename() { $longFileName = 'veryLongFileNameMoreThanTwenty'; $expectedFileName = 'veryLongFileNameMore...'; $this->assertEquals($expectedFileName, $this->helper->getShortFilename($longFileName, 20)); }