PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/magento/magento2-base/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php

https://gitlab.com/yousafsyed/easternglamor
PHP | 78 lines | 45 code | 8 blank | 25 comment | 2 complexity | a0b7df25a6e3b545f999e48b04b812e6 MD5 | raw file
  1. <?php
  2. /**
  3. * Copyright © 2016 Magento. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Backend\Test\Constraint;
  7. use Magento\Store\Test\Fixture\Store;
  8. use Magento\Mtf\Constraint\AbstractConstraint;
  9. use Magento\Backend\Test\Page\Adminhtml\SystemConfig;
  10. use Magento\Cms\Test\Page\CmsIndex;
  11. use Magento\Backend\Test\Page\Adminhtml\AdminCache;
  12. /**
  13. * Assert that store can be localized.
  14. */
  15. class AssertStoreCanBeLocalized extends AbstractConstraint
  16. {
  17. /**
  18. * Assert that locale options can be changed and checks new text on index page.
  19. *
  20. * @param SystemConfig $systemConfig
  21. * @param Store $store
  22. * @param CmsIndex $cmsIndex
  23. * @param AdminCache $adminCache
  24. * @param string $locale
  25. * @param string $welcomeText
  26. */
  27. public function processAssert(
  28. SystemConfig $systemConfig,
  29. Store $store,
  30. CmsIndex $cmsIndex,
  31. AdminCache $adminCache,
  32. $locale,
  33. $welcomeText
  34. ) {
  35. // Set locale options
  36. $systemConfig->open();
  37. $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
  38. $systemConfig->getModalBlock()->acceptAlert();
  39. $configGroup = $systemConfig->getForm()->getGroup('Locale Options');
  40. $configGroup->open();
  41. $configGroup->setValue('select-groups-locale-fields-code-value', $locale);
  42. $systemConfig->getPageActions()->save();
  43. $systemConfig->getMessagesBlock()->waitSuccessMessage();
  44. // Flush cache
  45. $adminCache->open();
  46. $adminCache->getActionsBlock()->flushMagentoCache();
  47. $adminCache->getMessagesBlock()->waitSuccessMessage();
  48. // Check presents income text on index page
  49. $cmsIndex->open();
  50. if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible()
  51. && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store)
  52. ) {
  53. $cmsIndex->getFooterBlock()->selectStoreGroup($store);
  54. }
  55. $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
  56. \PHPUnit_Framework_Assert::assertTrue(
  57. $cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText),
  58. "Locale not applied."
  59. );
  60. }
  61. /**
  62. * Returns a string representation of the object.
  63. *
  64. * @return string
  65. */
  66. public function toString()
  67. {
  68. return 'Store locale has changed successfully.';
  69. }
  70. }