Skip to content

Commit b70a54e

Browse files
MCLOUD-4077: Align ideal state wizard with scenario-based deployment (magento#715)
1 parent c8a3411 commit b70a54e

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/Config/Application/HookChecker.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77

88
namespace Magento\MagentoCloud\Config\Application;
99

10-
use Magento\MagentoCloud\Command\PostDeploy;
1110
use Magento\MagentoCloud\Config\Environment;
1211

1312
/**
1413
* Checks hooks enabling in .magento.app.yaml
1514
*/
1615
class HookChecker
1716
{
18-
const HOOK_POST_DEPLOY = 'post_deploy';
17+
private const HOOK_POST_DEPLOY = 'post_deploy';
1918

2019
/**
2120
* @var Environment
@@ -39,14 +38,8 @@ public function isPostDeployHookEnabled(): bool
3938
{
4039
$appConfig = $this->environment->getApplication();
4140

42-
if (isset($appConfig['hooks'][self::HOOK_POST_DEPLOY])) {
43-
$postDeployHooks = $appConfig['hooks'][self::HOOK_POST_DEPLOY];
41+
$postDeployHooks = $appConfig['hooks'][self::HOOK_POST_DEPLOY] ?? '';
4442

45-
if (preg_match(sprintf('/ece-tools\s+%s/', PostDeploy::NAME), $postDeployHooks)) {
46-
return true;
47-
}
48-
}
49-
50-
return false;
43+
return false !== strpos($postDeployHooks, '/ece-tools');
5144
}
5245
}

src/Config/Validator/Deploy/PostDeploy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function validate(): Validator\ResultInterface
4949
'In order to minimize downtime, add the following to ".magento.app.yaml":' . PHP_EOL .
5050
'hooks:' . PHP_EOL .
5151
' post_deploy: |' . PHP_EOL .
52-
' php ./vendor/bin/ece-tools post-deploy'
52+
' php ./vendor/bin/ece-tools run scenario/post-deploy.xml'
5353
);
5454
}
5555

src/Test/Unit/Config/Application/HookCheckerTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ class HookCheckerTest extends TestCase
2727
*/
2828
private $checker;
2929

30-
protected function setUp()
30+
/**
31+
* @inheritDoc
32+
*/
33+
protected function setUp(): void
3134
{
3235
$this->environmentMock = $this->createMock(Environment::class);
3336

@@ -37,9 +40,10 @@ protected function setUp()
3740
/**
3841
* @param array $hooks
3942
* @param bool $expectedResult
43+
*
4044
* @dataProvider isPostDeployEnabledDataProvider
4145
*/
42-
public function testIsPostDeployHookEnabled(array $hooks, bool $expectedResult)
46+
public function testIsPostDeployHookEnabled(array $hooks, bool $expectedResult): void
4347
{
4448
$this->environmentMock->expects($this->once())
4549
->method('getApplication')
@@ -59,8 +63,8 @@ public function isPostDeployEnabledDataProvider(): array
5963
true,
6064
],
6165
[
62-
['post_deploy' => 'php test\nphp test2\n'],
63-
false,
66+
['post_deploy' => 'php ./vendor/bin/ece-tools run'],
67+
true,
6468
],
6569
[
6670
['deploy' => 'php test\nphp test2\n'],

0 commit comments

Comments
 (0)