-
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.
Merge forwardport of #13408 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/13408.patch (created by @adrian-martinez-interactiv4) based on commit(s): 1. ca460ec
- Loading branch information
Showing
3 changed files
with
97 additions
and
3 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
56 changes: 56 additions & 0 deletions
56
...ion/testsuite/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabelTest.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,56 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Analytics\Block\Adminhtml\System\Config; | ||
|
||
use Magento\Framework\Data\FormFactory; | ||
use Magento\Framework\Data\Form\Element\TimeFactory; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Provide tests for CollectionTimeLabel block. | ||
*/ | ||
class CollectionTimeLabelTest extends TestCase | ||
{ | ||
/** | ||
* Test render will add comment considering config locale(default en_US). | ||
* | ||
* @magentoAppIsolation enabled | ||
*/ | ||
public function testRenderWithDefaultLocale() | ||
{ | ||
$result = $this->render(); | ||
$this->assertRegExp('/<span>Pacific Standard Time/', $result); | ||
} | ||
|
||
/** | ||
* Test render will add comment considering config locale(non-default de_DE). | ||
* | ||
* @magentoConfigFixture default_store general/locale/code de_DE | ||
* @magentoAppIsolation enabled | ||
*/ | ||
public function testRenderWithNonDefaultLocale() | ||
{ | ||
$result = $this->render(); | ||
$this->assertRegExp('/<span>Nordamerikanische Westküsten-Normalzeit/', $result); | ||
} | ||
|
||
/** | ||
* Render 'time' element. | ||
* | ||
* @return string | ||
*/ | ||
private function render() | ||
{ | ||
$collectionTimeLabel = Bootstrap::getObjectManager()->get(CollectionTimeLabelFactory::class)->create(); | ||
$form = Bootstrap::getObjectManager()->get(FormFactory::class)->create(); | ||
$element = Bootstrap::getObjectManager()->get(TimeFactory::class)->create(); | ||
$element->setForm($form); | ||
|
||
return $collectionTimeLabel->render($element); | ||
} | ||
} |