Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProgressTest.php
Go to the documentation of this file.
1 <?php
8 
9 use \Magento\Setup\Model\Installer\Progress;
10 
11 class ProgressTest extends \PHPUnit\Framework\TestCase
12 {
20  public function testConstructorExceptionInvalidTotal($total, $current)
21  {
22  new Progress($total, $current);
23  }
24 
29  {
30  return [[0,0], [0, 1], [[], 1]];
31  }
32 
38  {
39  new Progress(1, 2);
40  }
41 
42  public function testSetNext()
43  {
44  $progress = new Progress(10);
45  $progress->setNext();
46  $this->assertEquals(1, $progress->getCurrent());
47  }
48 
53  public function testSetNextException()
54  {
55  $progress = new Progress(10, 10);
56  $progress->setNext();
57  }
58 
59  public function testFinish()
60  {
61  $progress = new Progress(10);
62  $progress->finish();
63  $this->assertEquals(10, $progress->getCurrent());
64  }
65 
66  public function testGetCurrent()
67  {
68  $progress = new Progress(10, 5);
69  $this->assertEquals(5, $progress->getCurrent());
70  }
71 
72  public function testGetTotal()
73  {
74  $progress = new Progress(10);
75  $this->assertEquals(10, $progress->getTotal());
76  }
77 
83  public function testRatio($total, $current)
84  {
85  $progress = new Progress($total, $current);
86  $this->assertEquals($current / $total, $progress->getRatio());
87  }
88 
92  public function ratioDataProvider()
93  {
94  $data = [];
95  for ($i = 10; $i <= 20; $i++) {
96  for ($j = 0; $j <= $i; $j++) {
97  $data[] = [$i, $j];
98  }
99  }
100  return $data;
101  }
102 }
$i
Definition: gallery.phtml:31