-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Anton Fedurtsya <[email protected]>
- Loading branch information
Showing
22 changed files
with
237 additions
and
175 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidEsales\MediaLibrary\Image\Service; | ||
|
||
use OxidEsales\Eshop\Core\Config; | ||
use Symfony\Component\Filesystem\Path; | ||
|
||
class ImageResourceRefactored implements ImageResourceRefactoredInterface | ||
{ | ||
public const MEDIA_PATH = 'out/pictures/ddmedia'; | ||
|
||
public function __construct( | ||
protected Config $shopConfig, | ||
) { | ||
} | ||
|
||
public function getPathToMediaFiles(string $subDirectory = ''): string | ||
{ | ||
return Path::join( | ||
$this->shopConfig->getConfigParam('sShopDir'), | ||
self::MEDIA_PATH, | ||
$subDirectory | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Image\Service; | ||
|
||
interface ImageResourceRefactoredInterface | ||
{ | ||
public function getPathToMediaFiles(string $subDirectory = ''): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Service; | ||
|
||
use OxidEsales\MediaLibrary\Media\DataType\Media as MediaDataType; | ||
|
||
interface FolderServiceInterface | ||
{ | ||
public function createCustomDir(string $folderName): MediaDataType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
interface AddFolderRequestInterface | ||
{ | ||
public function getName(): string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace Image\Service; | ||
|
||
use OxidEsales\Eshop\Core\Config; | ||
use OxidEsales\MediaLibrary\Image\Service\ImageResourceRefactored; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OxidEsales\MediaLibrary\Image\Service\ImageResourceRefactored | ||
*/ | ||
class ImageResourceRefactoredTest extends TestCase | ||
{ | ||
public function testGetPathToMediaFiles(): void | ||
{ | ||
$sut = $this->getSut( | ||
shopConfig: $shopConfigStub = $this->createStub(Config::class) | ||
); | ||
$shopConfigStub->method('getConfigParam')->with('sShopDir')->willReturn('someShopDir'); | ||
|
||
$this->assertSame('someShopDir/' . ImageResourceRefactored::MEDIA_PATH, $sut->getPathToMediaFiles()); | ||
} | ||
|
||
public function testGetPathToMediaFilesWithSubdirectory(): void | ||
{ | ||
$sut = $this->getSut( | ||
shopConfig: $shopConfigStub = $this->createStub(Config::class) | ||
); | ||
$shopConfigStub->method('getConfigParam')->with('sShopDir')->willReturn('someShopDir'); | ||
|
||
$subDirectory = '/some/sub/directory'; | ||
$this->assertSame( | ||
'someShopDir/' . ImageResourceRefactored::MEDIA_PATH . $subDirectory, | ||
$sut->getPathToMediaFiles($subDirectory) | ||
); | ||
} | ||
|
||
protected function getSut( | ||
Config $shopConfig = null, | ||
) { | ||
return new ImageResourceRefactored( | ||
$shopConfig ?: $this->createStub(Config::class), | ||
); | ||
} | ||
} |
Oops, something went wrong.