/** * generate row * * @param string $filename * @return array */ protected function _generateRow($filename) { $row = parent::_generateRow($filename); $row['package'] = preg_replace('/\\.(xml)$/', '', str_replace($this->connectDirectory->getAbsolutePath(Settings::VAR_DIR_NAME . '/'), '', $filename)); $row['filename_id'] = $row['package']; $folder = explode('/', $row['package']); array_pop($folder); $row['folder'] = '/'; if (!empty($folder)) { $row['folder'] = implode('/', $folder) . '/'; } $row['safe_id'] = $this->encoder->encode($row['filename_id']); return $row; }
/** * @covers \Magento\Framework\Url\Encoder::encode * @covers \Magento\Framework\Url\Decoder::decode */ public function testDecode() { $urlBuilderMock = $this->getMock('Magento\\Framework\\UrlInterface', [], [], '', false); /** @var $urlBuilderMock \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */ $decoder = new Decoder($urlBuilderMock); $encoder = new Encoder(); $data = uniqid(); $result = $encoder->encode($data); $urlBuilderMock->expects($this->once())->method('sessionUrlVar')->with($this->equalTo($data))->will($this->returnValue($result)); $this->assertNotContains('&', $result); $this->assertNotContains('%', $result); $this->assertNotContains('+', $result); $this->assertNotContains('=', $result); $this->assertEquals($result, $decoder->decode($result)); }