ReferenceReplacementGenerationTest.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace tests\verification\Tests;
  7. use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
  8. use tests\util\MftfTestCase;
  9. class ReferenceReplacementGenerationTest extends MftfTestCase
  10. {
  11. const DATA_REPLACEMENT_TEST = 'DataReplacementTest';
  12. const PERSISTED_REPLACEMENT_TEST = 'PersistedReplacementTest';
  13. const PAGE_REPLACEMENT_TEST = 'PageReplacementTest';
  14. const ADMIN_PAGE_TEST = 'AdminPageTest';
  15. const SECTION_REPLACEMENT_TEST = 'SectionReplacementTest';
  16. const RESOURCES_PATH = __DIR__ . '/../Resources';
  17. /**
  18. * Tests replacement of {{data.key}} references.
  19. *
  20. * @throws \Exception
  21. * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
  22. */
  23. public function testDataReferenceReplacementCest()
  24. {
  25. $this->generateAndCompareTest(self::DATA_REPLACEMENT_TEST);
  26. }
  27. /**
  28. * Tests replacement of $data.key$ references.
  29. *
  30. * @throws \Exception
  31. * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
  32. */
  33. public function testPersistedeferenceReplacementCest()
  34. {
  35. $this->generateAndCompareTest(self::PERSISTED_REPLACEMENT_TEST);
  36. }
  37. /**
  38. * Tests replacement of {{page.url}} references. Includes parameterized urls.
  39. *
  40. * @throws \Exception
  41. * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
  42. */
  43. public function testPageReferenceReplacementCest()
  44. {
  45. $this->generateAndCompareTest(self::PAGE_REPLACEMENT_TEST);
  46. }
  47. /**
  48. * Tests replacement of {{page.url}} reference for external page and incompatible action
  49. */
  50. public function testExternalPageBadReference()
  51. {
  52. $this->expectException(TestReferenceException::class);
  53. $this->generateAndCompareTest("ExternalPageTestBadReference");
  54. }
  55. /**
  56. * Tests replacement of {{Section.Element}} references. Includes parameterized elements.
  57. *
  58. * @throws \Exception
  59. * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
  60. */
  61. public function testSectionReferenceReplacementCest()
  62. {
  63. $this->generateAndCompareTest(self::SECTION_REPLACEMENT_TEST);
  64. }
  65. /**
  66. * Tests replacement of all characters into string literal references.
  67. * Used to ensure users can input everything but single quotes into 'stringLiteral' in parameterized selectors
  68. */
  69. public function testCharacterReplacementCest()
  70. {
  71. $this->generateAndCompareTest("CharacterReplacementTest");
  72. }
  73. }