diff --git a/src/SmsConnector/AbstractConnector.php b/src/SmsConnector/AbstractConnector.php index 9fc39bd..76a805a 100644 --- a/src/SmsConnector/AbstractConnector.php +++ b/src/SmsConnector/AbstractConnector.php @@ -36,7 +36,7 @@ public function __construct( $debugMode = false ) { $this->debugMode = $debugMode; - $connectorConfig = json_decode($configuration->get('connectors') ?? '[]', true)['config'][static::getType()] ?? []; + $connectorConfig = json_decode($configuration->get('connectors')['config'] ?? '[]', true)[static::getType()] ?? []; $this->checkConfig($connectorConfig); } diff --git a/tests/SmsConnector/EuroSmsConnectorTest.php b/tests/SmsConnector/EuroSmsConnectorTest.php index 10a88c8..25bc601 100644 --- a/tests/SmsConnector/EuroSmsConnectorTest.php +++ b/tests/SmsConnector/EuroSmsConnectorTest.php @@ -19,17 +19,17 @@ public function testCheckConfig() ->method('get') ->with('connectors') ->willReturn( - json_encode( - [ - 'config' => [ + [ + 'config' => json_encode( + [ 'eurosms' => [ 'gatewayId' => 'Id', 'gatewayKey' => 'Key', 'gatewaySenderNumber' => 'SenderNumber', ] ] - ] - ) + ) + ] ); $smsConnector = new EuroSmsConnector( $configuration, @@ -68,17 +68,17 @@ public function testCheckConfigError( ->method('get') ->with('connectors') ->willReturn( - json_encode( - [ - 'config' => [ + [ + 'config' => json_encode( + [ 'eurosms' => [ 'gatewayId' => $gatewayId, 'gatewayKey' => $gatewayKey, 'gatewaySenderNumber' => $gatewaySenderNumber, ] ] - ] - ) + ) + ] ); $smsConnector = new EuroSmsConnector( $configuration, @@ -114,17 +114,17 @@ public function testRespond() ->method('get') ->with('connectors') ->willReturn( - json_encode( - [ - 'config' => [ + [ + 'config' => json_encode( + [ 'eurosms' => [ 'gatewayId' => 'Id', 'gatewayKey' => 'Key', 'gatewaySenderNumber' => 'SenderNumber', ] ] - ] - ) + ) + ] ); $smsConnector = new EuroSmsConnector( $configuration, @@ -148,17 +148,17 @@ public function testSend() ->method('get') ->with('connectors') ->willReturn( - json_encode( - [ - 'config' => [ + [ + 'config' => json_encode( + [ 'eurosms' => [ 'gatewayId' => 'Id', 'gatewayKey' => 'Key', 'gatewaySenderNumber' => 'SenderNumber', ] ] - ] - ) + ) + ] ); $smsConnector = new EuroSmsConnector( $configuration,