Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
setup
src
Magento
Setup
Test
Unit
Model
Complex
ComplexGeneratorTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Setup\Test\Unit\Model\Complex
;
8
9
use
Magento\Setup\Model\Complex\Pattern
;
10
use
Magento\Setup\Model\Complex\Generator
;
11
16
class
ComplexGeneratorTest
extends
\PHPUnit\Framework\TestCase
17
{
23
protected
$_pattern
;
24
30
protected
function
getPattern
()
31
{
32
if
(!$this->_pattern instanceof
Pattern
) {
33
$patternData = [
34
[
35
'id'
=>
'%s'
,
36
'name'
=>
'Static'
,
37
'calculated'
=>
function
(
$index
) {
38
return
$index
* 10;
39
},
40
],
41
[
42
'name'
=>
'xxx %s'
43
],
44
[
45
'name'
=>
'yyy %s'
46
],
47
];
48
$this->_pattern =
new
Pattern
();
49
$this->_pattern->setHeaders(array_keys($patternData[0]));
50
$this->_pattern->setRowsSet($patternData);
51
}
52
return
$this->_pattern
;
53
}
54
60
public
function
testIteratorInterface
()
61
{
62
$model
=
new
Generator
($this->
getPattern
(), 2);
63
$rows = [];
64
foreach
(
$model
as
$row
) {
65
$rows[] =
$row
;
66
}
67
$this->assertEquals(
68
[
69
[
'id'
=>
'1'
,
'name'
=>
'Static'
,
'calculated'
=> 10],
70
[
'id'
=>
''
,
'name'
=>
'xxx 1'
,
'calculated'
=>
''
],
71
[
'id'
=>
''
,
'name'
=>
'yyy 1'
,
'calculated'
=>
''
],
72
[
'id'
=>
'2'
,
'name'
=>
'Static'
,
'calculated'
=> 20],
73
[
'id'
=>
''
,
'name'
=>
'xxx 2'
,
'calculated'
=>
''
],
74
[
'id'
=>
''
,
'name'
=>
'yyy 2'
,
'calculated'
=>
''
],
75
],
76
$rows
77
);
78
}
79
85
public
function
testGetIndex
()
86
{
87
$model
=
new
Generator
($this->
getPattern
(), 4);
88
for
(
$i
= 0;
$i
< 32;
$i
++) {
89
$this->assertEquals(
$model
->getIndex(
$i
), floor(
$i
/ $this->
getPattern
()->getRowsCount()) + 1);
90
}
91
}
92
}
Magento\Setup\Test\Unit\Model\Complex\ComplexGeneratorTest\$_pattern
$_pattern
Definition:
ComplexGeneratorTest.php:23
$model
$model
Definition:
enable_catalog_product_reindex_schedule.php:9
Magento\Setup\Test\Unit\Model\Complex\ComplexGeneratorTest\testIteratorInterface
testIteratorInterface()
Definition:
ComplexGeneratorTest.php:60
Magento\Setup\Test\Unit\Model\Complex\ComplexGeneratorTest\testGetIndex
testGetIndex()
Definition:
ComplexGeneratorTest.php:85
Magento\Setup\Test\Unit\Model\Complex\ComplexGeneratorTest
Definition:
ComplexGeneratorTest.php:16
Magento\Setup\Model\Complex\Generator
Definition:
Generator.php:16
Magento\Setup\Test\Unit\Model\Complex\ComplexGeneratorTest\getPattern
getPattern()
Definition:
ComplexGeneratorTest.php:30
Magento\Setup\Test\Unit\Model\Complex
Definition:
ComplexGeneratorTest.php:7
Magento\Setup\Model\Complex\Pattern
Definition:
Pattern.php:14
$i
$i
Definition:
gallery.phtml:31
$index
$index
Definition:
list.phtml:44
$row
$row
Definition:
cart_rule_free_shipping.php:12