-
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.
Use getLanguageStrings language method through MediaLibrary LanguageI…
…nterface Signed-off-by: Anton Fedurtsya <[email protected]>
- Loading branch information
Showing
8 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace OxidEsales\MediaLibrary\Transition\Core; | ||
|
||
interface LanguageInterface | ||
{ | ||
public function getLanguageStringsArray(): array; | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace OxidEsales\MediaLibrary\Transition\Core; | ||
|
||
use OxidEsales\MediaLibrary\Core\Language; | ||
|
||
class LanguageProxy implements LanguageInterface | ||
{ | ||
/** @var Language $language */ | ||
private $language; | ||
|
||
public function __construct(\OxidEsales\Eshop\Core\Language $language) | ||
{ | ||
/** @var Language $language */ | ||
$this->language = $language; | ||
} | ||
|
||
public function getLanguageStringsArray(): array | ||
{ | ||
return $this->language->getLanguageStrings(); | ||
} | ||
} |
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,10 @@ | ||
services: | ||
_defaults: | ||
public: false | ||
autowire: true | ||
bind: | ||
OxidEsales\Eshop\Core\Language: '@=service("OxidEsales\\MediaLibrary\\Core\\Registry").getLang()' | ||
|
||
OxidEsales\MediaLibrary\Transition\Core\LanguageInterface: | ||
class: OxidEsales\MediaLibrary\Transition\Core\LanguageProxy | ||
public: true |
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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\MediaLibrary\Tests\Integration\Transition\Core; | ||
|
||
use OxidEsales\MediaLibrary\Transition\Core\Language; | ||
use OxidEsales\MediaLibrary\Transition\Core\LanguageProxy; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class LanguageProxyTest extends TestCase | ||
{ | ||
public function testGetLanguageStrings(): void | ||
{ | ||
$languageStringsList = ['somekey' => 'someValue']; | ||
|
||
/** @var \OxidEsales\Eshop\Core\Language $languageMock */ | ||
$languageMock = $this->createPartialMock(Language::class, ['getLanguageStrings']); | ||
$languageMock->method('getLanguageStrings')->willReturn($languageStringsList); | ||
|
||
$sut = new LanguageProxy($languageMock); | ||
|
||
$this->assertSame($languageStringsList, $sut->getLanguageStringsArray()); | ||
} | ||
} |