Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProgressFactoryTest.php
Go to the documentation of this file.
1 <?php
8 
9 use \Magento\Setup\Model\Installer\ProgressFactory;
10 
11 class ProgressFactoryTest extends \PHPUnit\Framework\TestCase
12 {
13  public function testCreateFromLog()
14  {
15  $contents = [
16  '[Progress: 1 / 5] Installing A...',
17  'Output from A...',
18  '[Progress: 2 / 5] Installing B...',
19  'Output from B...',
20  '[Progress: 3 / 5] Installing C...',
21  'Output from C...',
22  ];
23  $logger = $this->createMock(\Magento\Setup\Model\WebLogger::class);
24  $logger->expects($this->once())->method('get')->will($this->returnValue($contents));
25 
26  $progressFactory = new ProgressFactory();
27  $progress = $progressFactory->createFromLog($logger);
28  $this->assertEquals(3, $progress->getCurrent());
29  $this->assertEquals(5, $progress->getTotal());
30  }
31 }
$contents
Definition: website.php:14
$logger