Skip to content

Commit

Permalink
symfony sms connector configuration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sveneld committed Jun 1, 2024
1 parent 16f8cbf commit 9425713
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/SmsConnector/AbstractConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
$debugMode = false
) {
$this->debugMode = $debugMode;
$connectorConfig = json_decode($configuration->get('connectors')['config'] ?? '[]', true)[static::getType()] ?? [];
$connectorConfig = json_decode($configuration->get('connectors')['config'][static::getType()] ?? '[]', true) ?? [];
$this->checkConfig($connectorConfig);
}

Expand Down
40 changes: 20 additions & 20 deletions tests/SmsConnector/EuroSmsConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public function testCheckConfig()
->with('connectors')
->willReturn(
[
'config' => json_encode(
[
'eurosms' => [
'config' => [
'eurosms' => json_encode(
[
'gatewayId' => 'Id',
'gatewayKey' => 'Key',
'gatewaySenderNumber' => 'SenderNumber',
]
]
)
)
]
]
);
$smsConnector = new EuroSmsConnector(
Expand Down Expand Up @@ -69,15 +69,15 @@ public function testCheckConfigError(
->with('connectors')
->willReturn(
[
'config' => json_encode(
[
'eurosms' => [
'config' => [
'eurosms' => json_encode(
[
'gatewayId' => $gatewayId,
'gatewayKey' => $gatewayKey,
'gatewaySenderNumber' => $gatewaySenderNumber,
]
]
)
)
]
]
);
$smsConnector = new EuroSmsConnector(
Expand Down Expand Up @@ -115,15 +115,15 @@ public function testRespond()
->with('connectors')
->willReturn(
[
'config' => json_encode(
[
'eurosms' => [
'config' => [
'eurosms' => json_encode(
[
'gatewayId' => 'Id',
'gatewayKey' => 'Key',
'gatewaySenderNumber' => 'SenderNumber',
]
]
)
)
]
]
);
$smsConnector = new EuroSmsConnector(
Expand All @@ -149,15 +149,15 @@ public function testSend()
->with('connectors')
->willReturn(
[
'config' => json_encode(
[
'eurosms' => [
'config' => [
'eurosms' => json_encode(
[
'gatewayId' => 'Id',
'gatewayKey' => 'Key',
'gatewaySenderNumber' => 'SenderNumber',
]
]
)
)
]
]
);
$smsConnector = new EuroSmsConnector(
Expand Down

0 comments on commit 9425713

Please sign in to comment.