IndexerTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Indexer\Controller\Adminhtml;
  7. /**
  8. * @magentoAppArea adminhtml
  9. */
  10. class IndexerTest extends \Magento\TestFramework\TestCase\AbstractBackendController
  11. {
  12. /**
  13. * Assert that current page is index management page and that it has indexers mode selector
  14. *
  15. * @return void
  16. */
  17. public function testIndexersMode()
  18. {
  19. $this->dispatch('backend/indexer/indexer/list/');
  20. $body = $this->getResponse()->getBody();
  21. $this->assertContains('<h1 class="page-title">Index Management</h1>', $body);
  22. $this->assertEquals(
  23. 1,
  24. \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
  25. '//*[@id="gridIndexer_massaction-select"]',
  26. $body
  27. ),
  28. 'Mode selector is not found'
  29. );
  30. $this->assertContains('option value="change_mode_onthefly"', $body);
  31. $this->assertContains('option value="change_mode_changelog"', $body);
  32. }
  33. /**
  34. * Assert that index management contains a certain number of indexers
  35. *
  36. * @return void
  37. */
  38. public function testDefaultNumberOfIndexers()
  39. {
  40. $this->dispatch('backend/indexer/indexer/list/');
  41. $body = $this->getResponse()->getBody();
  42. $this->assertGreaterThanOrEqual(
  43. 1,
  44. \Magento\TestFramework\Helper\Xpath::getElementsCountForXpath(
  45. '//*[@name="indexer_ids"]',
  46. $body
  47. ),
  48. 'Indexer list is empty'
  49. );
  50. }
  51. }