Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InfoCurrencyListCommandTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Symfony\Component\Console\Tester\CommandTester;
11 
12 class InfoCurrencyListCommandTest extends \PHPUnit\Framework\TestCase
13 {
14  public function testExecute()
15  {
16  $currencies = [
17  'CUR' => 'Currency description'
18  ];
19 
20  $table = $this->createMock(\Symfony\Component\Console\Helper\Table::class);
21  $table->expects($this->once())->method('setHeaders')->with(['Currency', 'Code']);
22  $table->expects($this->once())->method('addRow')->with(['Currency description', 'CUR']);
23 
25  $tableFactoryMock = $this->createMock(\Symfony\Component\Console\Helper\TableFactory::class);
26  $tableFactoryMock->expects($this->once())->method('create')->will($this->returnValue($table));
27 
29  $list = $this->createMock(\Magento\Framework\Setup\Lists::class);
30  $list->expects($this->once())->method('getCurrencyList')->will($this->returnValue($currencies));
31  $command = new InfoCurrencyListCommand($list, $tableFactoryMock);
32  $commandTester = new CommandTester($command);
33  $commandTester->execute([]);
34  }
35 }
$table
Definition: trigger.php:14