Skip to content

Commit

Permalink
Move input/output related classes to separate domain
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <anton@fedurtsya.com>
  • Loading branch information
Sieg committed Oct 4, 2023
1 parent e4973d6 commit f3786b1
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 27 deletions.
1 change: 1 addition & 0 deletions services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ imports:
- { resource: src/Service/services.yaml }
- { resource: src/Settings/services.yaml }
- { resource: src/Transition/Core/services.yaml }
- { resource: src/Transput/services.yaml }

services:
_defaults:
Expand Down
2 changes: 1 addition & 1 deletion src/Service/InvoiceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace FreshAdvance\Invoice\Service;

use FreshAdvance\Invoice\Transition\Core\UtilsInterface;
use FreshAdvance\Invoice\Transput\UtilsInterface;

class InvoiceService implements InvoiceServiceInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Service/RequestDataConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use FreshAdvance\Invoice\DataType\InvoiceConfiguration;
use FreshAdvance\Invoice\DataType\InvoiceConfigurationInterface;
use FreshAdvance\Invoice\Transition\Core\RequestInterface;
use FreshAdvance\Invoice\Transput\RequestInterface;

class RequestDataConverter implements RequestDataConverterInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Transition/Controller/Admin/InvoiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use FreshAdvance\Invoice\Service\InvoiceServiceInterface;
use FreshAdvance\Invoice\Service\RequestDataConverterInterface;
use FreshAdvance\Invoice\Traits\ServiceContainer;
use FreshAdvance\Invoice\Transition\Core\RequestInterface;
use FreshAdvance\Invoice\Transput\RequestInterface;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;

class InvoiceController extends AdminController
Expand Down
10 changes: 0 additions & 10 deletions src/Transition/Core/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ services:
public: false
autowire: true
bind:
OxidEsales\Eshop\Core\Utils: '@=service("FreshAdvance\\Invoice\\Core\\Registry").getUtils()'
OxidEsales\Eshop\Core\Request: '@=service("FreshAdvance\\Invoice\\Core\\Registry").getRequest()'
OxidEsales\Eshop\Core\Language: '@=service("FreshAdvance\\Invoice\\Core\\Registry").getLang()'

FreshAdvance\Invoice\Transition\Core\LanguageInterface:
class: FreshAdvance\Invoice\Transition\Core\LanguageProxy
public: true

FreshAdvance\Invoice\Transition\Core\UtilsInterface:
class: FreshAdvance\Invoice\Transition\Core\UtilsProxy
public: true

FreshAdvance\Invoice\Transition\Core\RequestInterface:
class: FreshAdvance\Invoice\Transition\Core\RequestProxy
public: true
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Invoice\Transition\Core;
namespace FreshAdvance\Invoice\Transput;

interface RequestInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Invoice\Transition\Core;
namespace FreshAdvance\Invoice\Transput;

use OxidEsales\Eshop\Core\Request;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Invoice\Transition\Core;
namespace FreshAdvance\Invoice\Transput;

interface UtilsInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

declare(strict_types=1);

namespace FreshAdvance\Invoice\Transition\Core;
namespace FreshAdvance\Invoice\Transput;

use FreshAdvance\Invoice\Transput\UtilsInterface;
use OxidEsales\Eshop\Core\Utils;

class UtilsProxy implements UtilsInterface
Expand Down
15 changes: 15 additions & 0 deletions src/Transput/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
_defaults:
public: false
autowire: true
bind:
OxidEsales\Eshop\Core\Request: '@=service("FreshAdvance\\Invoice\\Core\\Registry").getRequest()'
OxidEsales\Eshop\Core\Utils: '@=service("FreshAdvance\\Invoice\\Core\\Registry").getUtils()'

FreshAdvance\Invoice\Transput\RequestInterface:
class: FreshAdvance\Invoice\Transput\RequestProxy
public: true

FreshAdvance\Invoice\Transput\UtilsInterface:
class: FreshAdvance\Invoice\Transput\UtilsProxy
public: true
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use FreshAdvance\Invoice\Service\Invoice;
use FreshAdvance\Invoice\Service\InvoiceServiceInterface;
use FreshAdvance\Invoice\Transition\Controller\Admin\InvoiceController;
use FreshAdvance\Invoice\Transition\Core\RequestInterface;
use FreshAdvance\Invoice\Transition\Core\RequestProxy;
use FreshAdvance\Invoice\Transput\RequestInterface;
use FreshAdvance\Invoice\Transput\RequestProxy;
use PHPUnit\Framework\TestCase;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Transition/Core/RequestProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

namespace Transition\Core;

use FreshAdvance\Invoice\Transition\Core\RequestProxy;
use FreshAdvance\Invoice\Transput\RequestProxy;
use OxidEsales\Eshop\Core\Request;
use PHPUnit\Framework\TestCase;

/**
* @covers \FreshAdvance\Invoice\Transition\Core\RequestProxy
* @covers \FreshAdvance\Invoice\Transput\RequestProxy
*/
class RequestProxyTest extends TestCase
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Integration/Transition/Core/UtilsProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

namespace Transition\Core;

use FreshAdvance\Invoice\Transition\Core\UtilsProxy;
use FreshAdvance\Invoice\Transput\UtilsProxy;
use OxidEsales\Eshop\Core\Utils;
use PHPUnit\Framework\TestCase;

/**
* @covers \FreshAdvance\Invoice\Transition\Core\UtilsProxy
* @covers \FreshAdvance\Invoice\Transput\UtilsProxy
*/
class UtilsProxyTest extends TestCase
{
Expand All @@ -25,7 +25,7 @@ public function testSetHeaderProxied(): void
$utilsMock = $this->createPartialMock(Utils::class, ['setHeader']);
$utilsMock->expects($this->once())->method('setHeader')->with($testValue);

$sut = new UtilsProxy($utilsMock);
$sut = new \FreshAdvance\Invoice\Transput\UtilsProxy($utilsMock);
$sut->setHeader($testValue);
}

Expand All @@ -36,7 +36,7 @@ public function testShowMessageAndExitProxied(): void
$utilsMock = $this->createPartialMock(Utils::class, ['showMessageAndExit']);
$utilsMock->expects($this->once())->method('showMessageAndExit')->with($testValue);

$sut = new UtilsProxy($utilsMock);
$sut = new \FreshAdvance\Invoice\Transput\UtilsProxy($utilsMock);
$sut->showMessageAndExit($testValue);
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Service/InvoiceServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace FreshAdvance\Invoice\Tests\Unit\Service;

use FreshAdvance\Invoice\Service\InvoiceService;
use FreshAdvance\Invoice\Transition\Core\UtilsProxy;
use FreshAdvance\Invoice\Transput\UtilsProxy;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\TestCase;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Service/RequestDataConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace FreshAdvance\Invoice\Tests\Unit\Service;

use FreshAdvance\Invoice\Service\RequestDataConverter;
use FreshAdvance\Invoice\Transition\Core\RequestInterface;
use FreshAdvance\Invoice\Transput\RequestInterface;
use OxidEsales\Eshop\Core\Request;
use PHPUnit\Framework\TestCase;

Expand Down

0 comments on commit f3786b1

Please sign in to comment.