correct phpcs config

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p) 2018-02-27 09:30:57 +01:00
parent b46d3a3769
commit b097c19c0a
4 changed files with 43 additions and 34 deletions

View File

@ -1555,7 +1555,7 @@ class Domains extends ApiCommand implements ResourceEntity
// trigger when domain id for alias destination has changed: both for old and new destination
triggerLetsEncryptCSRForAliasDestinationDomain($result['aliasdomain'], $this->logger());
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $this->logger());
} else if ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) {
} elseif ($result['wwwserveralias'] != $wwwserveralias || $result['letsencrypt'] != $letsencrypt) {
// or when wwwserveralias or letsencrypt was changed
triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $this->logger());
}

View File

@ -83,20 +83,24 @@ class Froxlor extends ApiCommand
/**
*
* @todo import settings
*
*
* @access admin
*/
public function importSettings()
{}
{
throw new Exception("Not available yet.", 501);
}
/**
*
* @todo export settings to file
*
*
* @access admin
*/
public function exportSettings()
{}
{
throw new Exception("Not available yet.", 501);
}
/**
* return a list of all settings
@ -202,7 +206,7 @@ class Froxlor extends ApiCommand
array_push($functions, array_merge(array(
'module' => $module,
'function' => $func->name
), $this->_getParamListFromDoc($module, $func->name)));
), $this->getParamListFromDoc($module, $func->name)));
}
}
} else {
@ -234,7 +238,7 @@ class Froxlor extends ApiCommand
array_push($functions, array_merge(array(
'module' => $matches[1],
'function' => $func->name
), $this->_getParamListFromDoc($matches[1], $func->name)));
), $this->getParamListFromDoc($matches[1], $func->name)));
}
}
}
@ -259,7 +263,7 @@ class Froxlor extends ApiCommand
* @throws Exception
* @return array|bool
*/
private function _getParamListFromDoc($module = null, $function = null)
private function getParamListFromDoc($module = null, $function = null)
{
try {
// set the module
@ -307,7 +311,8 @@ class Froxlor extends ApiCommand
'type' => $r[1],
'desc' => (isset($r[2]) ? trim($r[2]) : '')
);
} else if (! empty($c) && strpos($c, '@throws') === false) {
}
elseif (! empty($c) && strpos($c, '@throws') === false) {
if (substr($c, 0, 3) == "/**") {
continue;
}
@ -331,7 +336,7 @@ class Froxlor extends ApiCommand
}
}
}
$result['head'] =trim($result['head']);
$result['head'] = trim($result['head']);
return $result;
} catch (\ReflectionException $e) {
return array();

View File

@ -1,15 +1,12 @@
<?xml version="1.0"?>
<ruleset name="PSR2-Froxlor">
<description>PSR2 with tabs instead of spaces.</description>
<config name="show_progress" value="1" />
<config name="ignore_warnings_on_exit" value="1" />
<arg name="tab-width" value="4" />
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="1" />
<property name="tabIndent" value="true" />
</properties>
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
</ruleset>

View File

@ -37,7 +37,9 @@ class CustomersTest extends TestCase
'custom_notes' => 'secret',
'custom_notes_show' => 0,
'gender' => 5,
'allowed_phpconfigs' => array(1)
'allowed_phpconfigs' => array(
1
)
];
$json_result = Customers::getLocal($admin_userdata, $data)->add();
@ -67,7 +69,7 @@ class CustomersTest extends TestCase
'firstname' => 'Test2',
'name' => 'Testman2'
];
$this->expectExceptionMessage('Requested parameter "email" is empty where it should not be for "Customers:add"');
Customers::getLocal($admin_userdata, $data)->add();
}
@ -127,12 +129,11 @@ class CustomersTest extends TestCase
'id' => 1
))->get();
$customer_userdata = json_decode($json_result, true)['data'];
$this->expectExceptionCode(403);
$this->expectExceptionMessage("Not allowed to execute given command.");
$json_result = Customers::getLocal($customer_userdata)->list();
}
/**
@ -248,7 +249,7 @@ class CustomersTest extends TestCase
'id' => 1,
'deactivated' => 0
))->update();
// get customer
$json_result = Customers::getLocal($admin_userdata, array(
'id' => 1
@ -283,7 +284,7 @@ class CustomersTest extends TestCase
))->get();
$reseller_userdata = json_decode($json_result, true)['data'];
$reseller_userdata['adminsession'] = 1;
$this->expectExceptionMessage("You cannot allocate more resources than you own for yourself.");
// add new customer
$data = [
@ -292,12 +293,12 @@ class CustomersTest extends TestCase
'firstname' => 'Test',
'name' => 'Testman',
'customernumber' => 1338,
'subdomains' => -1,
'subdomains' => - 1,
'new_customer_password' => 'h0lYmo1y'
];
Customers::getLocal($reseller_userdata, $data)->add();
}
public function testCustomerCustomersDelete()
{
global $admin_userdata;
@ -308,7 +309,9 @@ class CustomersTest extends TestCase
$customer_userdata = json_decode($json_result, true)['data'];
$this->expectExceptionCode(403);
$this->expectExceptionMessage("Not allowed to execute given command.");
Customers::getLocal($customer_userdata, array('loginname' => 'test1'))->delete();
Customers::getLocal($customer_userdata, array(
'loginname' => 'test1'
))->delete();
}
public function testResellerCustomersDeleteNotOwned()
@ -321,7 +324,9 @@ class CustomersTest extends TestCase
$reseller_userdata = json_decode($json_result, true)['data'];
$reseller_userdata['adminsession'] = 1;
$this->expectExceptionCode(404);
Customers::getLocal($reseller_userdata, array('loginname' => 'test1'))->delete();
Customers::getLocal($reseller_userdata, array(
'loginname' => 'test1'
))->delete();
}
public function testAdminCustomersDelete()
@ -337,11 +342,13 @@ class CustomersTest extends TestCase
'new_customer_password' => 'h0lYmo1y'
];
Customers::getLocal($admin_userdata, $data)->add();
$json_result = Customers::getLocal($admin_userdata, array('loginname' => 'test2'))->delete();
$json_result = Customers::getLocal($admin_userdata, array(
'loginname' => 'test2'
))->delete();
$result = json_decode($json_result, true)['data'];
$this->assertEquals('test2', $result['loginname']);
}
public function testAdminCustomersUnlock()
{
global $admin_userdata;
@ -353,7 +360,7 @@ class CustomersTest extends TestCase
$result = json_decode($json_result, true)['data'];
$this->assertEquals(0, $result['loginfail_count']);
}
public function testAdminCustomersUnlockNotAllowed()
{
global $admin_userdata;
@ -366,7 +373,7 @@ class CustomersTest extends TestCase
'loginname' => 'test1'
))->unlock();
}
public function testAdminCustomersMoveNotAllowed()
{
global $admin_userdata;
@ -380,7 +387,7 @@ class CustomersTest extends TestCase
'adminid' => 1
))->move();
}
public function testAdminCustomersMoveTargetIsSource()
{
global $admin_userdata;
@ -403,5 +410,5 @@ class CustomersTest extends TestCase
$this->assertEquals(2, $result['adminid']);
}
}