-
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.
- Loading branch information
1 parent
e075ca7
commit a6c2bc2
Showing
2 changed files
with
72 additions
and
1 deletion.
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
57 changes: 57 additions & 0 deletions
57
...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,57 @@ | ||
<?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); | ||
} | ||
|
||
} |