File tree Expand file tree Collapse file tree
tests/Unit/Greeting/Transput Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Copyright © OXID eSales AG. All rights reserved.
5+ * See LICENSE file for license details.
6+ */
7+
8+ declare (strict_types=1 );
9+
10+ namespace OxidEsales \ExamplesModule \Greeting \Transput ;
11+
12+ class Request implements RequestInterface
13+ {
14+ public function __construct (
15+ protected \OxidEsales \Eshop \Core \Request $ request
16+ ) {
17+ }
18+
19+ public function getEditObjectId (): string
20+ {
21+ return (string ) $ this ->request ->getRequestParameter ('oxid ' );
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Copyright © OXID eSales AG. All rights reserved.
5+ * See LICENSE file for license details.
6+ */
7+
8+ namespace OxidEsales \ExamplesModule \Greeting \Transput ;
9+
10+ interface RequestInterface
11+ {
12+ public function getEditObjectId (): string ;
13+ }
Original file line number Diff line number Diff line change @@ -20,3 +20,7 @@ services:
2020 OxidEsales\ExamplesModule\Greeting\Service\UserServiceInterface :
2121 class : OxidEsales\ExamplesModule\Greeting\Service\UserService
2222 public : true
23+
24+ OxidEsales\ExamplesModule\Greeting\Transput\RequestInterface :
25+ class : OxidEsales\ExamplesModule\Greeting\Transput\Request
26+ public : true
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Copyright © OXID eSales AG. All rights reserved.
5+ * See LICENSE file for license details.
6+ */
7+
8+ namespace Greeting \Transput ;
9+
10+ use OxidEsales \ExamplesModule \Greeting \Transput \Request ;
11+ use OxidEsales \Eshop \Core \Request as ShopRequest ;
12+ use PHPUnit \Framework \Attributes \Test ;
13+ use PHPUnit \Framework \TestCase ;
14+
15+ final class RequestTest extends TestCase
16+ {
17+ #[Test]
18+ public function getEditObjectId (): void
19+ {
20+ $ editObjectId = uniqid ();
21+
22+ $ shopRequestMock = $ this ->createMock (ShopRequest::class);
23+ $ shopRequestMock ->method ('getRequestParameter ' )
24+ ->with ('oxid ' )
25+ ->willReturn ($ editObjectId );
26+
27+ $ sut = new Request ($ shopRequestMock );
28+ $ this ->assertSame ($ editObjectId , $ sut ->getEditObjectId ());
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments