Slight better formatting

This commit is contained in:
Roeland Jago Douma 2015-03-11 15:11:50 +01:00
parent 09ee297356
commit e9a003fe21
2 changed files with 11 additions and 47 deletions

View File

@ -58,13 +58,14 @@ class Capabilities {
$public = []; $public = [];
$public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes';
if ($public['enabled']) { if ($public['enabled']) {
$public['password_enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'yes') === 'yes'); $public['password'] = [];
$public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'yes') === 'yes');
$public['expire_date'] = []; $public['expire_date'] = [];
$public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'yes') === 'yes'; $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'yes') === 'yes';
if ($public['expire_date']['enabled']) { if ($public['expire_date']['enabled']) {
$public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
$public['expire_date']['enforce'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'yes') === 'yes'; $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'yes') === 'yes';
} }
$public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'yes') === 'yes'; $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'yes') === 'yes';

View File

@ -57,9 +57,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
return $result; return $result;
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testNoLinkSharing() { public function testNoLinkSharing() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'no'], ['core', 'shareapi_allow_links', 'yes', 'no'],
@ -69,9 +66,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertFalse($result['public']['enabled']); $this->assertFalse($result['public']['enabled']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testOnlyLinkSharing() { public function testOnlyLinkSharing() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
@ -81,35 +75,28 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertTrue($result['public']['enabled']); $this->assertTrue($result['public']['enabled']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkPassword() { public function testLinkPassword() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_enforce_links_password', 'yes', 'yes'], ['core', 'shareapi_enforce_links_password', 'yes', 'yes'],
]; ];
$result = $this->getResults($map); $result = $this->getResults($map);
$this->assertArrayHasKey('password_enforced', $result['public']); $this->assertArrayHasKey('password', $result['public']);
$this->assertTrue($result['public']['password_enforced']); $this->assertArrayHasKey('enforced', $result['public']['password']);
$this->assertTrue($result['public']['password']['enforced']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkNoPassword() { public function testLinkNoPassword() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_enforce_links_password', 'yes', 'no'], ['core', 'shareapi_enforce_links_password', 'yes', 'no'],
]; ];
$result = $this->getResults($map); $result = $this->getResults($map);
$this->assertArrayHasKey('password_enforced', $result['public']); $this->assertArrayHasKey('password', $result['public']);
$this->assertFalse($result['public']['password_enforced']); $this->assertArrayHasKey('enforced', $result['public']['password']);
$this->assertFalse($result['public']['password']['enforced']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkNoExpireDate() { public function testLinkNoExpireDate() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
@ -121,9 +108,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertFalse($result['public']['expire_date']['enabled']); $this->assertFalse($result['public']['expire_date']['enabled']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkExpireDate() { public function testLinkExpireDate() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
@ -136,12 +120,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertInternalType('array', $result['public']['expire_date']); $this->assertInternalType('array', $result['public']['expire_date']);
$this->assertTrue($result['public']['expire_date']['enabled']); $this->assertTrue($result['public']['expire_date']['enabled']);
$this->assertArrayHasKey('days', $result['public']['expire_date']); $this->assertArrayHasKey('days', $result['public']['expire_date']);
$this->assertFalse($result['public']['expire_date']['enforce']); $this->assertFalse($result['public']['expire_date']['enforced']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkExpireDateEnforced() { public function testLinkExpireDateEnforced() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
@ -151,12 +132,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$result = $this->getResults($map); $result = $this->getResults($map);
$this->assertArrayHasKey('expire_date', $result['public']); $this->assertArrayHasKey('expire_date', $result['public']);
$this->assertInternalType('array', $result['public']['expire_date']); $this->assertInternalType('array', $result['public']['expire_date']);
$this->assertTrue($result['public']['expire_date']['enforce']); $this->assertTrue($result['public']['expire_date']['enforced']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkSendMail() { public function testLinkSendMail() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
@ -166,9 +144,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertTrue($result['public']['send_mail']); $this->assertTrue($result['public']['send_mail']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testLinkNoSendMail() { public function testLinkNoSendMail() {
$map = [ $map = [
['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'],
@ -178,9 +153,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertFalse($result['public']['send_mail']); $this->assertFalse($result['public']['send_mail']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testUserSendMail() { public function testUserSendMail() {
$map = [ $map = [
['core', 'shareapi_allow_mail_notification', 'yes', 'yes'], ['core', 'shareapi_allow_mail_notification', 'yes', 'yes'],
@ -189,9 +161,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertTrue($result['user']['send_mail']); $this->assertTrue($result['user']['send_mail']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testUserNoSendMail() { public function testUserNoSendMail() {
$map = [ $map = [
['core', 'shareapi_allow_mail_notification', 'yes', 'no'], ['core', 'shareapi_allow_mail_notification', 'yes', 'no'],
@ -200,9 +169,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertFalse($result['user']['send_mail']); $this->assertFalse($result['user']['send_mail']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testResharing() { public function testResharing() {
$map = [ $map = [
['core', 'shareapi_allow_resharing', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'yes'],
@ -211,9 +177,6 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertTrue($result['resharing']); $this->assertTrue($result['resharing']);
} }
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function testNoResharing() { public function testNoResharing() {
$map = [ $map = [
['core', 'shareapi_allow_resharing', 'yes', 'no'], ['core', 'shareapi_allow_resharing', 'yes', 'no'],