-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OXDEV-8213 Improve CoreThemeFactory along test coverage
- Loading branch information
1 parent
27a41cd
commit 69f90a9
Showing
2 changed files
with
51 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\ConfigurationAccess\Tests\Unit\Theme\Infrastructure; | ||
|
||
use OxidEsales\GraphQL\ConfigurationAccess\Theme\Infrastructure\CoreThemeFactory; | ||
use PHPUnit\Framework\TestCase; | ||
use OxidEsales\Eshop\Core\Theme; | ||
|
||
/** | ||
* @covers \OxidEsales\GraphQL\ConfigurationAccess\Theme\Infrastructure\CoreThemeFactory | ||
*/ | ||
class CoreThemeFactoryTest extends TestCase | ||
{ | ||
public function testCreateProducesCorrectTypeOfObjects(): void | ||
{ | ||
$sut = $this->getSut(); | ||
$this->assertInstanceOf(Theme::class, $sut->create()); | ||
} | ||
|
||
public function testCreateProducesDifferentObjectsOnEveryCall(): void | ||
{ | ||
$model1 = $this->getSut()->create(); | ||
$model2 = $this->getSut()->create(); | ||
|
||
$this->assertNotSame($model1, $model2); | ||
} | ||
|
||
private function getSut(): CoreThemeFactory | ||
{ | ||
$coreThemeFactoryMock = $this->getMockBuilder(CoreThemeFactory::class) | ||
->onlyMethods(['createTheme']) | ||
->getMock(); | ||
|
||
$coreThemeFactoryMock->method('createTheme') | ||
->willReturn(new Theme()); | ||
|
||
return $coreThemeFactoryMock; | ||
} | ||
} |