Commit 15cc5bd8 authored by alexpott's avatar alexpott

Issue #2345879 by marcvangend: Added Enhance ThirdPartySettingsTrait with a...

Issue #2345879 by marcvangend: Added Enhance ThirdPartySettingsTrait with a get-all-settings method.
parent 046bf09b
......@@ -67,6 +67,19 @@ public function getThirdPartySetting($module, $key, $default = NULL) {
}
}
/**
* Gets all third-party settings of a given module.
*
* @param string $module
* The module providing the third-party settings.
*
* @return array
* An array of key-value pairs.
*/
public function getThirdPartySettings($module) {
return isset($this->third_party_settings[$module]) ? $this->third_party_settings[$module] : array();
}
/**
* Unsets a third-party setting.
*
......
......@@ -19,6 +19,7 @@ class ThirdPartySettingsTraitTest extends UnitTestCase {
/**
* @covers ::getThirdPartySetting
* @covers ::setThirdPartySetting
* @covers ::getThirdPartySettings
* @covers ::unsetThirdPartySetting
* @covers ::getThirdPartyProviders
*/
......@@ -38,6 +39,10 @@ public function testThirdPartySettings() {
$this->assertEquals($value, $trait_object->getThirdPartySetting($third_party, $key));
$this->assertEquals($value, $trait_object->getThirdPartySetting($third_party, $key, $this->randomGenerator->string()));
// Test getThirdPartySettings().
$trait_object->setThirdPartySetting($third_party, 'test2', 'value2');
$this->assertEquals(array($key => $value, 'test2' => 'value2'), $trait_object->getThirdPartySettings($third_party));
// Test getThirdPartyProviders().
$trait_object->setThirdPartySetting('test_provider2', $key, $value);
$this->assertEquals(array($third_party, 'test_provider2'), $trait_object->getThirdPartyProviders());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment