-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGCOM-7110: Fix Report date doesn't matching in configuration setting …
- Loading branch information
Showing
2 changed files
with
76 additions
and
24 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
58 changes: 58 additions & 0 deletions
58
.../integration/testsuite/Magento/Reports/Block/Adminhtml/Config/Form/Field/YtdStartTest.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,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Reports\Block\Adminhtml\Config\Form\Field; | ||
|
||
use Magento\TestFramework\TestCase\AbstractBackendController; | ||
|
||
/** | ||
* Test for \Magento\Reports\Block\Adminhtml\Config\Form\Field\YtdStart. | ||
* | ||
* @magentoAppArea adminhtml | ||
*/ | ||
class YtdStartTest extends AbstractBackendController | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private $monthNumbers = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']; | ||
|
||
/** | ||
* Test Get Month and Day Element renderer | ||
* | ||
* @return void | ||
* @magentoAppIsolation enabled | ||
* @magentoDbIsolation enabled | ||
*/ | ||
public function testGetElementHtml(): void | ||
{ | ||
$this->dispatch('backend/admin/system_config/edit/section/reports/'); | ||
$body = $this->getResponse()->getBody(); | ||
|
||
$this->assertContains($this->getOptionsHtml('01'), $body); | ||
} | ||
|
||
/** | ||
* Options html | ||
* | ||
* @param string $selected | ||
* @return string | ||
*/ | ||
private function getOptionsHtml(string $selected): string | ||
{ | ||
$html = ''; | ||
foreach ($this->monthNumbers as $number) { | ||
$html .= $number === $selected | ||
? '<option value="' . $selected . '" selected="selected">' . $selected . '</option>' | ||
: '<option value="' . $number . '">' . $number . '</option>'; | ||
|
||
$html .= PHP_EOL; | ||
} | ||
|
||
return $html; | ||
} | ||
} |