IndexerInfoCommandTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Indexer\Test\Unit\Console\Command;
  7. use Magento\Backend\App\Area\FrontNameResolver;
  8. use Magento\Indexer\Console\Command\IndexerInfoCommand;
  9. use Symfony\Component\Console\Tester\CommandTester;
  10. class IndexerInfoCommandTest extends AbstractIndexerCommandCommonSetup
  11. {
  12. /**
  13. * Command being tested
  14. *
  15. * @var IndexerInfoCommand
  16. */
  17. private $command;
  18. protected function setUp()
  19. {
  20. parent::setUp();
  21. $this->stateMock->expects($this->once())->method('setAreaCode')->with(FrontNameResolver::AREA_CODE);
  22. }
  23. public function testExecute()
  24. {
  25. $this->configureAdminArea();
  26. $indexerOne = $this->getIndexerMock(
  27. [],
  28. ['indexer_id' => 'id_indexerOne', 'title' => 'Title_indexerOne']
  29. );
  30. $this->initIndexerCollectionByItems([$indexerOne]);
  31. $this->command = new IndexerInfoCommand($this->objectManagerFactory);
  32. $commandTester = new CommandTester($this->command);
  33. $commandTester->execute([]);
  34. $actualValue = $commandTester->getDisplay();
  35. $this->assertSame(sprintf('%-40s %s', 'id_indexerOne', 'Title_indexerOne') . PHP_EOL, $actualValue);
  36. }
  37. }