Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertStoreCanBeLocalized.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Backend\Test\Page\Adminhtml\SystemConfig;
12 use Magento\Cms\Test\Page\CmsIndex;
13 use Magento\PageCache\Test\Page\Adminhtml\AdminCache;
14 
18 class AssertStoreCanBeLocalized extends AbstractConstraint
19 {
30  public function processAssert(
31  SystemConfig $systemConfig,
32  Store $store,
33  CmsIndex $cmsIndex,
34  AdminCache $adminCache,
35  $locale,
36  $welcomeText
37  ) {
38  // Set locale options
39  $systemConfig->open();
40  $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
41  $systemConfig->getModalBlock()->acceptAlert();
42  $configGroup = $systemConfig->getForm()->getGroup('general', 'locale', 'code');
43  $configGroup->setValue('general', 'locale', 'code', $locale);
44  $systemConfig->getPageActions()->save();
45  $systemConfig->getMessagesBlock()->waitSuccessMessage();
46 
47  // Flush cache
48  $adminCache->open();
49  $adminCache->getActionsBlock()->flushMagentoCache();
50  $adminCache->getMessagesBlock()->waitSuccessMessage();
51 
52  // Check presents income text on index page
53  $cmsIndex->open();
54  if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible()
55  && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store)
56  ) {
57  $cmsIndex->getFooterBlock()->selectStoreGroup($store);
58  }
59 
60  $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
61 
62  \PHPUnit\Framework\Assert::assertTrue(
63  $cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText),
64  "Locale not applied."
65  );
66  }
67 
73  public function toString()
74  {
75  return 'Store locale has changed successfully.';
76  }
77 }
processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, AdminCache $adminCache, $locale, $welcomeText)