[true, 'sandbox_account', 'sandbox-value'], 'production' => [false, 'production_account', 'production-value'], ]; } #[DataProvider('environmentProvider')] public function testSelectsCredentialsForTheActiveEnvironment( bool $sandbox, string $field, string $expected ): void { $scopeConfig = $this->createMock(ScopeConfigInterface::class); $scopeConfig->method('isSetFlag') ->with( 'payment/' . Config::METHOD_CODE . '/sandbox', ScopeInterface::SCOPE_STORE, 1 ) ->willReturn($sandbox); $scopeConfig->method('getValue') ->with( 'payment/' . Config::METHOD_CODE . '/' . $field, ScopeInterface::SCOPE_STORE, 1 ) ->willReturn($expected); $config = new Config( $scopeConfig, new SecretValueDecoder($this->createMock(\Magento\Framework\Encryption\EncryptorInterface::class)) ); self::assertSame($expected, $config->getSecret('account', 1)); } }