コード例 #1
0
ファイル: Database.php プロジェクト: pradeep-wagento/magento2
 /**
  * Load entity by path
  *
  * @param  \Magento\MediaStorage\Model\File\Storage\Directory\Database $object
  * @param  string $path
  * @return $this
  */
 public function loadByPath(\Magento\MediaStorage\Model\File\Storage\Directory\Database $object, $path)
 {
     $connection = $this->getConnection();
     $name = basename($path);
     $path = dirname($path);
     if ($path == '.') {
         $path = '';
     }
     $select = $connection->select()->from(['e' => $this->getMainTable()])->where('name = ?', $name)->where($connection->prepareSqlCondition('path', ['seq' => $path]));
     $data = $connection->fetchRow($select);
     if ($data) {
         $object->setData($data);
         $this->_afterLoad($object);
     }
     return $this;
 }
コード例 #2
0
 public function testGetDirsCollectionCreateSubDirectories()
 {
     $directoryName = 'test1';
     $this->coreFileStorageMock->expects($this->once())->method('checkDbUsage')->willReturn(true);
     $this->directoryCollectionMock->expects($this->once())->method('getSubdirectories')->with(self::STORAGE_ROOT_DIR)->willReturn([['name' => $directoryName]]);
     $this->directoryDatabaseFactoryMock->expects($this->once())->method('create')->willReturn($this->directoryCollectionMock);
     $this->directoryMock->expects($this->once())->method('create')->with(rtrim(self::STORAGE_ROOT_DIR, '/') . '/' . $directoryName);
     $this->generalTestGetDirsCollection(self::STORAGE_ROOT_DIR);
 }