15
15
use Magento \MagentoCloud \Package \MagentoVersion ;
16
16
use PHPUnit \Framework \MockObject \MockObject ;
17
17
use PHPUnit \Framework \TestCase ;
18
+ use Magento \MagentoCloud \Config \Stage \DeployInterface ;
18
19
19
20
/**
20
21
* @inheritdoc
@@ -60,16 +61,12 @@ protected function setUp(): void
60
61
);
61
62
}
62
63
63
- public function testValidateVersionGreaterTwoDotTwo ()
64
+ public function testValidateVersion ()
64
65
{
65
- $ this ->magentoVersion ->expects ($ this ->once ())
66
- ->method ('isGreaterOrEqual ' )
67
- ->with ('2.2 ' )
68
- ->willReturn (true );
69
- $ this ->magentoVersion ->expects ($ this ->once ())
66
+ $ this ->magentoVersion ->expects ($ this ->exactly (2 ))
70
67
->method ('isGreaterOrEqual ' )
71
- ->with ( '2.4.7 ' )
72
- ->willReturn ( true );
68
+ ->withConsecutive ([ '2.2 ' ], [ ' 2. 4.7 '] )
69
+ ->willReturnOnConsecutiveCalls ( true , true );
73
70
$ this ->magentoVersion ->expects ($ this ->once ())
74
71
->method ('satisfies ' )
75
72
->willReturn (true );
@@ -79,40 +76,32 @@ public function testValidateVersionGreaterTwoDotTwo()
79
76
$ this ->assertInstanceOf (Success::class, $ this ->validator ->validate ());
80
77
}
81
78
82
- public function testValidateVersionTwoDotOneAndVariablesNotConfigured ()
79
+ public function testValidateVersionAndVariablesNotConfigured ()
83
80
{
84
- $ this ->magentoVersion ->expects ($ this ->once ( ))
81
+ $ this ->magentoVersion ->expects ($ this ->exactly ( 2 ))
85
82
->method ('isGreaterOrEqual ' )
86
- ->with ('2.2 ' )
87
- ->willReturn (false );
88
- $ this ->magentoVersion ->expects ($ this ->once ())
89
- ->method ('isGreaterOrEqual ' )
90
- ->with ('2.4.7 ' )
91
- ->willReturn (false );
83
+ ->withConsecutive (['2.2 ' ], ['2.4.7 ' ])
84
+ ->willReturnOnConsecutiveCalls (false , false );
92
85
$ this ->magentoVersion ->expects ($ this ->once ())
93
86
->method ('satisfies ' )
94
87
->willReturn (false );
95
- $ this ->configurationCheckerMock ->expects ($ this ->exactly (4 ))
88
+ $ this ->configurationCheckerMock ->expects ($ this ->exactly (6 ))
96
89
->method ('isConfigured ' )
97
90
->willReturn (false );
98
91
99
92
$ this ->assertInstanceOf (Success::class, $ this ->validator ->validate ());
100
93
}
101
94
102
- public function testValidateVersionTwoDotOneAndAllVariablesAreConfigured ()
95
+ public function testValidateVersionAndAllVariablesAreConfigured ()
103
96
{
104
- $ this ->magentoVersion ->expects ($ this ->once ( ))
97
+ $ this ->magentoVersion ->expects ($ this ->exactly ( 2 ))
105
98
->method ('isGreaterOrEqual ' )
106
- ->with ('2.2 ' )
107
- ->willReturn (false );
108
- $ this ->magentoVersion ->expects ($ this ->once ())
109
- ->method ('isGreaterOrEqual ' )
110
- ->with ('2.4.7 ' )
111
- ->willReturn (false );
99
+ ->withConsecutive (['2.2 ' ], ['2.4.7 ' ])
100
+ ->willReturnOnConsecutiveCalls (false , false );
112
101
$ this ->magentoVersion ->expects ($ this ->once ())
113
102
->method ('satisfies ' )
114
103
->willReturn (false );
115
- $ this ->configurationCheckerMock ->expects ($ this ->exactly (4 ))
104
+ $ this ->configurationCheckerMock ->expects ($ this ->exactly (6 ))
116
105
->method ('isConfigured ' )
117
106
->willReturn (true );
118
107
$ this ->resultFactoryMock ->expects ($ this ->once ())
@@ -123,7 +112,9 @@ public function testValidateVersionTwoDotOneAndAllVariablesAreConfigured()
123
112
'CRON_CONSUMERS_RUNNER is available for Magento 2.2.0 and later. ' ,
124
113
'SCD_STRATEGY is available for Magento 2.2.0 and later. ' ,
125
114
'SCD_MAX_EXECUTION_TIME is available for Magento 2.2.0 and later. ' ,
126
- 'GENERATED_CODE_SYMLINK is available for Magento 2.1.x. '
115
+ 'GENERATED_CODE_SYMLINK is available for Magento 2.1.x. ' ,
116
+ 'USE_LUA is available for Magento 2.4.7 and later. ' ,
117
+ 'LUA_KEY is available for Magento 2.4.7 and later. '
127
118
])
128
119
);
129
120
0 commit comments