forked from magento/magento2
-
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.
merge magento/2.3-develop into magento-engcom/graphql-develop-prs
- Loading branch information
Showing
34 changed files
with
519 additions
and
147 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
89 changes: 89 additions & 0 deletions
89
app/code/Magento/Cron/Test/Unit/Model/System/Config/Initial/ConverterTest.php
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,89 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Cron\Test\Unit\Model\System\Config\Initial; | ||
|
||
use Magento\Cron\Model\Groups\Config\Data as GroupsConfigModel; | ||
use Magento\Cron\Model\System\Config\Initial\Converter as ConverterPlugin; | ||
use Magento\Framework\App\Config\Initial\Converter; | ||
|
||
/** | ||
* Class ConverterTest | ||
* | ||
* Unit test for \Magento\Cron\Model\System\Config\Initial\Converter | ||
*/ | ||
class ConverterTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var GroupsConfigModel|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $groupsConfigMock; | ||
|
||
/** | ||
* @var Converter|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $converterMock; | ||
|
||
/** | ||
* @var ConverterPlugin | ||
*/ | ||
private $converterPlugin; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->groupsConfigMock = $this->getMockBuilder( | ||
GroupsConfigModel::class | ||
)->disableOriginalConstructor()->getMock(); | ||
$this->converterMock = $this->getMockBuilder(Converter::class)->getMock(); | ||
$this->converterPlugin = new ConverterPlugin($this->groupsConfigMock); | ||
} | ||
|
||
/** | ||
* Tests afterConvert method with no $result['data']['default']['system'] set | ||
*/ | ||
public function testAfterConvertWithNoData() | ||
{ | ||
$expectedResult = ['test']; | ||
$this->groupsConfigMock->expects($this->never()) | ||
->method('get'); | ||
|
||
$result = $this->converterPlugin->afterConvert($this->converterMock, $expectedResult); | ||
|
||
self::assertSame($expectedResult, $result); | ||
} | ||
|
||
/** | ||
* Tests afterConvert method with $result['data']['default']['system'] set | ||
*/ | ||
public function testAfterConvertWithData() | ||
{ | ||
$groups = [ | ||
'group1' => ['val1' => ['value' => '1']], | ||
'group2' => ['val2' => ['value' => '2']] | ||
]; | ||
$expectedResult['data']['default']['system']['cron'] = [ | ||
'group1' => [ | ||
'val1' => '1' | ||
], | ||
'group2' => [ | ||
'val2' => '2' | ||
] | ||
]; | ||
$result['data']['default']['system']['cron'] = '1'; | ||
|
||
$this->groupsConfigMock->expects($this->once()) | ||
->method('get') | ||
->willReturn($groups); | ||
|
||
$result = $this->converterPlugin->afterConvert($this->converterMock, $result); | ||
|
||
self::assertEquals($expectedResult, $result); | ||
} | ||
} |
Oops, something went wrong.