Skip to content

Commit 50a9518

Browse files
authored
MCLOUD-6712: Fix error method parameters for DatabaseSplitConnection validator (magento#772)
1 parent fa5a312 commit 50a9518

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

src/Config/Validator/Deploy/DatabaseSplitConnection.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,21 @@ public function validate(): Validator\ResultInterface
6363
return $this->resultFactory->success();
6464
}
6565

66-
return $this->resultFactory->error(sprintf(
67-
'Split database configuration was detected in the property %s'
68-
. ' of the file .magento.env.yaml:' . PHP_EOL
69-
. '%s' . PHP_EOL
70-
. 'Magento Cloud does not support a custom split database configuration,'
71-
. ' such configurations will be ignored',
72-
DeployInterface::VAR_DATABASE_CONFIGURATION,
73-
implode(PHP_EOL, $messageItem),
66+
return $this->resultFactory->error(
67+
sprintf(
68+
'Detected split database configuration in the %s property of the file .magento.env.yaml:' . PHP_EOL
69+
. '%s' . PHP_EOL
70+
. 'Magento Cloud does not support custom connections in the split database configuration,'
71+
. ' Custom connections will be ignored',
72+
DeployInterface::VAR_DATABASE_CONFIGURATION,
73+
implode(PHP_EOL, $messageItem)
74+
),
75+
sprintf(
76+
'Update the %s variable in the \'.magento.env.yaml\' file to remove custom connections '
77+
. 'for split databases.',
78+
DeployInterface::VAR_DATABASE_CONFIGURATION
79+
),
7480
Error::WARN_WRONG_SPLIT_DB_CONFIG
75-
));
81+
);
7682
}
7783
}

src/Test/Unit/Config/Validator/Deploy/DatabaseSplitConnectionTest.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\MagentoCloud\Test\Unit\Config\Validator\Deploy;
99

10+
use Magento\MagentoCloud\App\Error as ApplicationError;
1011
use Magento\MagentoCloud\Config\ConfigException;
1112
use Magento\MagentoCloud\Config\Stage\DeployInterface;
1213
use Magento\MagentoCloud\Config\Validator\Deploy\DatabaseSplitConnection;
@@ -78,14 +79,19 @@ public function testMessageValidate()
7879
->willReturn($dbConfiguration);
7980
$this->resultFactoryMock->expects($this->once())
8081
->method('error')
81-
->with('Split database configuration was detected in the property DATABASE_CONFIGURATION of the'
82-
. ' file .magento.env.yaml:' . PHP_EOL
83-
. '- connection: checkout' . PHP_EOL
84-
. '- connection: sales' . PHP_EOL
85-
. '- slave_connection: checkout' . PHP_EOL
86-
. '- slave_connection: sales' . PHP_EOL
87-
. 'Magento Cloud does not support a custom split database configuration,'
88-
. ' such configurations will be ignored');
82+
->with(
83+
'Detected split database configuration in the DATABASE_CONFIGURATION property of the'
84+
. ' file .magento.env.yaml:' . PHP_EOL
85+
. '- connection: checkout' . PHP_EOL
86+
. '- connection: sales' . PHP_EOL
87+
. '- slave_connection: checkout' . PHP_EOL
88+
. '- slave_connection: sales' . PHP_EOL
89+
. 'Magento Cloud does not support custom connections in the split database configuration,'
90+
. ' Custom connections will be ignored',
91+
'Update the DATABASE_CONFIGURATION variable in the \'.magento.env.yaml\' file to remove '
92+
. 'custom connections for split databases.',
93+
ApplicationError::WARN_WRONG_SPLIT_DB_CONFIG
94+
);
8995

9096
$this->assertInstanceOf(Error::class, $this->validator->validate());
9197
}

0 commit comments

Comments
 (0)