diff options
Diffstat (limited to 'apps/sharebymail/tests/SettingsTest.php')
-rw-r--r-- | apps/sharebymail/tests/SettingsTest.php | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/apps/sharebymail/tests/SettingsTest.php b/apps/sharebymail/tests/SettingsTest.php index f415421b0cf..8b2fc200d57 100644 --- a/apps/sharebymail/tests/SettingsTest.php +++ b/apps/sharebymail/tests/SettingsTest.php @@ -24,6 +24,7 @@ namespace OCA\ShareByMail\Tests; use OCA\ShareByMail\Settings; +use OCA\ShareByMail\Settings\SettingsManager; use Test\TestCase; class SettingsTest extends TestCase { @@ -31,10 +32,15 @@ class SettingsTest extends TestCase { /** @var Settings */ private $instance; + /** @var SettingsManager | \PHPUnit_Framework_MockObject_MockObject */ + private $settingsManager; + public function setUp() { parent::setUp(); - $this->instance = new Settings(); + $this->settingsManager = $this->getMockBuilder(SettingsManager::class) + ->disableOriginalConstructor()->getMock(); + $this->instance = new Settings($this->settingsManager); } public function testAnnounceShareProvider() { @@ -61,4 +67,30 @@ class SettingsTest extends TestCase { $this->assertSame($after, $before); } + + public function testAnnounceShareByMailSettings() { + $this->settingsManager->expects($this->once())->method('enforcePasswordProtection')->willReturn(true); + $before = [ + 'oc_appconfig' => + json_encode([ + 'key1' => 'value1', + 'key2' => 'value2' + ]), + 'oc_foo' => 'oc_bar' + ]; + + $after = [ + 'oc_appconfig' => + json_encode([ + 'key1' => 'value1', + 'key2' => 'value2', + 'shareByMail' => ['enforcePasswordProtection' => true] + ]), + 'oc_foo' => 'oc_bar' + ]; + + $this->instance->announceShareByMailSettings(['array' => &$before]); + $this->assertSame($after, $before); + } + } |