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

@@ -87,7 +87,9 @@ class Froxlor extends ApiCommand
* @access admin * @access admin
*/ */
public function importSettings() public function importSettings()
{} {
throw new Exception("Not available yet.", 501);
}
/** /**
* *
@@ -96,7 +98,9 @@ class Froxlor extends ApiCommand
* @access admin * @access admin
*/ */
public function exportSettings() public function exportSettings()
{} {
throw new Exception("Not available yet.", 501);
}
/** /**
* return a list of all settings * return a list of all settings
@@ -202,7 +206,7 @@ class Froxlor extends ApiCommand
array_push($functions, array_merge(array( array_push($functions, array_merge(array(
'module' => $module, 'module' => $module,
'function' => $func->name 'function' => $func->name
), $this->_getParamListFromDoc($module, $func->name))); ), $this->getParamListFromDoc($module, $func->name)));
} }
} }
} else { } else {
@@ -234,7 +238,7 @@ class Froxlor extends ApiCommand
array_push($functions, array_merge(array( array_push($functions, array_merge(array(
'module' => $matches[1], 'module' => $matches[1],
'function' => $func->name '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 * @throws Exception
* @return array|bool * @return array|bool
*/ */
private function _getParamListFromDoc($module = null, $function = null) private function getParamListFromDoc($module = null, $function = null)
{ {
try { try {
// set the module // set the module
@@ -307,7 +311,8 @@ class Froxlor extends ApiCommand
'type' => $r[1], 'type' => $r[1],
'desc' => (isset($r[2]) ? trim($r[2]) : '') '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) == "/**") { if (substr($c, 0, 3) == "/**") {
continue; continue;
} }

View File

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

View File

@@ -37,7 +37,9 @@ class CustomersTest extends TestCase
'custom_notes' => 'secret', 'custom_notes' => 'secret',
'custom_notes_show' => 0, 'custom_notes_show' => 0,
'gender' => 5, 'gender' => 5,
'allowed_phpconfigs' => array(1) 'allowed_phpconfigs' => array(
1
)
]; ];
$json_result = Customers::getLocal($admin_userdata, $data)->add(); $json_result = Customers::getLocal($admin_userdata, $data)->add();
@@ -132,7 +134,6 @@ class CustomersTest extends TestCase
$this->expectExceptionMessage("Not allowed to execute given command."); $this->expectExceptionMessage("Not allowed to execute given command.");
$json_result = Customers::getLocal($customer_userdata)->list(); $json_result = Customers::getLocal($customer_userdata)->list();
} }
/** /**
@@ -308,7 +309,9 @@ class CustomersTest extends TestCase
$customer_userdata = json_decode($json_result, true)['data']; $customer_userdata = json_decode($json_result, true)['data'];
$this->expectExceptionCode(403); $this->expectExceptionCode(403);
$this->expectExceptionMessage("Not allowed to execute given command."); $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() public function testResellerCustomersDeleteNotOwned()
@@ -321,7 +324,9 @@ class CustomersTest extends TestCase
$reseller_userdata = json_decode($json_result, true)['data']; $reseller_userdata = json_decode($json_result, true)['data'];
$reseller_userdata['adminsession'] = 1; $reseller_userdata['adminsession'] = 1;
$this->expectExceptionCode(404); $this->expectExceptionCode(404);
Customers::getLocal($reseller_userdata, array('loginname' => 'test1'))->delete(); Customers::getLocal($reseller_userdata, array(
'loginname' => 'test1'
))->delete();
} }
public function testAdminCustomersDelete() public function testAdminCustomersDelete()
@@ -337,7 +342,9 @@ class CustomersTest extends TestCase
'new_customer_password' => 'h0lYmo1y' 'new_customer_password' => 'h0lYmo1y'
]; ];
Customers::getLocal($admin_userdata, $data)->add(); 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']; $result = json_decode($json_result, true)['data'];
$this->assertEquals('test2', $result['loginname']); $this->assertEquals('test2', $result['loginname']);
} }
@@ -403,5 +410,5 @@ class CustomersTest extends TestCase
$this->assertEquals(2, $result['adminid']); $this->assertEquals(2, $result['adminid']);
} }
} }