-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OXDEV-8462 Add oxnew factory example
- Loading branch information
1 parent
cdd8779
commit 597baad
Showing
8 changed files
with
89 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ public function render() | |
|
||
return parent::render(); | ||
} | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\ModuleTemplate\Infrastructure; | ||
|
||
use OxidEsales\Eshop\Core\Request; | ||
|
||
class CoreRequestFactory implements CoreRequestFactoryInterface | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function create(): Request | ||
{ | ||
return oxNew(Request::class); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidEsales\ModuleTemplate\Infrastructure; | ||
|
||
use OxidEsales\Eshop\Core\Request; | ||
|
||
interface CoreRequestFactoryInterface | ||
{ | ||
/** | ||
* @return Request | ||
*/ | ||
public function create(): Request; | ||
} |
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,29 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\ModuleTemplate\Tests\Unit\Infrastructure; | ||
|
||
use OxidEsales\ModuleTemplate\Infrastructure\CoreRequestFactory; | ||
use PHPUnit\Framework\TestCase; | ||
use OxidEsales\Eshop\Core\Request; | ||
|
||
/** | ||
* @covers \OxidEsales\ModuleTemplate\Infrastructure\CoreRequestFactory | ||
*/ | ||
class CoreRequestFactoryTest extends TestCase | ||
{ | ||
public function testCreateProducesCorrectTypeOfObjects(): void | ||
{ | ||
$coreThemeFactoryMock = $this->getMockBuilder(CoreRequestFactory::class) | ||
->onlyMethods(['create']) | ||
->getMock(); | ||
|
||
$this->assertInstanceOf(Request::class, $coreThemeFactoryMock->create()); | ||
} | ||
} |
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