Completed
Push — test-environment ( 1806a4...345bd9 )
by Julius
05:55
created
controller/settingscontroller.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 use \OCP\INavigationManager;
9 9
 use \OCA\AppOrder\Service\ConfigService;
10 10
 
11
-class SettingsController extends Controller{
11
+class SettingsController extends Controller {
12 12
 
13 13
     private $userId;
14 14
     private $l10n;
15 15
     private $appConfig;
16 16
     private $navigationManager;
17 17
 
18
-    public function __construct($appName, IRequest $request, ConfigService $appConfig, INavigationManager $navigationManager, $userId){
18
+    public function __construct($appName, IRequest $request, ConfigService $appConfig, INavigationManager $navigationManager, $userId) {
19 19
         parent::__construct($appName, $request);
20 20
         $this->userId = $userId;
21 21
         $this->appConfig = $appConfig;
22 22
         $this->navigationManager = $navigationManager;
23 23
     }
24 24
 
25
-    public function adminIndex(){
25
+    public function adminIndex() {
26 26
         $navigation = $this->navigationManager->getAll();
27 27
         $order = json_decode($this->appConfig->getAppValue('order'));
28 28
         $nav = $this->matchOrder($navigation, $order);
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
     private function matchOrder($nav, $order) {
48 48
         $nav_tmp = array();
49 49
         $result = array();
50
-        foreach($nav as $app)
50
+        foreach ($nav as $app)
51 51
             $nav_tmp[$app['href']] = $app;
52
-        foreach($order as $app)
52
+        foreach ($order as $app)
53 53
             $result[$app] = $nav_tmp[$app];
54
-        foreach($nav as $app)
55
-            if(!array_key_exists($app['href'], $result))
54
+        foreach ($nav as $app)
55
+            if (!array_key_exists($app['href'], $result))
56 56
                 $result[$app['href']] = $app;
57 57
         return $result;
58 58
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @NoAdminRequired
62 62
      */
63
-    public function getOrder(){
63
+    public function getOrder() {
64 64
         $order = $this->getAppOrder();
65 65
         return array('status' => 'success', 'order' => $order);
66 66
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     /**
69 69
      * @NoAdminRequired
70 70
      */
71
-    public function savePersonal($order){
71
+    public function savePersonal($order) {
72 72
         $this->appConfig->setUserValue('order', $this->userId, $order);
73 73
         $response = array(
74 74
             'status' => 'success',
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
         return $response;
79 79
     }
80 80
 
81
-    public function saveDefaultOrder($order){
82
-        if (!is_null($order)){
83
-            $this->appConfig->setAppValue('order',$order);
81
+    public function saveDefaultOrder($order) {
82
+        if (!is_null($order)) {
83
+            $this->appConfig->setAppValue('order', $order);
84 84
         }
85 85
         return array('status' => 'success', 'order' => $order);
86 86
     }
Please login to merge, or discard this patch.
appinfo/application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 class Application extends App {
9 9
 
10
-    public function __construct(array $urlParams=array()){
10
+    public function __construct(array $urlParams = array()) {
11 11
         parent::__construct('apporder', $urlParams);
12 12
         $container = $this->getContainer();
13 13
         $container->registerService('ConfigService', function($c) {
Please login to merge, or discard this patch.
service/configservice.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     private $config;
10 10
     private $appName;
11 11
 
12
-    public function __construct(IConfig $config, $appName){
12
+    public function __construct(IConfig $config, $appName) {
13 13
         $this->config = $config;
14 14
         $this->appName = $appName;
15 15
     }
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
  * @copyright jus 2016
10 10
  */
11 11
 
12
-require_once __DIR__ . '/../../../tests/bootstrap.php';
13
-require_once __DIR__ . '/../appinfo/autoload.php';
12
+require_once __DIR__.'/../../../tests/bootstrap.php';
13
+require_once __DIR__.'/../appinfo/autoload.php';
14 14
 
15
-\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
15
+\OC::$loader->addValidRoot(OC::$SERVERROOT.'/tests');
16 16
 \OC_App::loadApp('apporder');
Please login to merge, or discard this patch.
tests/unit/controller/SettingsControllerTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   private $appName;
20 20
   private $controller;
21 21
   private $config;
22
-  public function setUp (){
22
+  public function setUp() {
23 23
 
24 24
     parent::setUp();
25 25
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $this->service = $this->getMockBuilder('\OCA\AppOrder\Service\ConfigService')
35 35
       ->disableOriginalConstructor()
36 36
       ->getMock();
37
-    $this->navigationManager = $this->getMockBuilder('\OCP\INavigationManager')->setMethods(['getAll','add','setActiveEntry'])
37
+    $this->navigationManager = $this->getMockBuilder('\OCP\INavigationManager')->setMethods(['getAll', 'add', 'setActiveEntry'])
38 38
       ->disableOriginalConstructor()
39 39
       ->getMock();
40 40
     $this->userId = 'admin';
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
   }
102 102
 
103 103
   public function testGetAppOrder() {
104
-    $nav_system= ['/app/calendar/', '/app/tasks/'];
104
+    $nav_system = ['/app/calendar/', '/app/tasks/'];
105 105
     $nav_user = ['/app/files/', '/app/calendar/', '/app/tasks/'];
106 106
     $this->service->expects($this->once())
107 107
       ->method('getAppValue')
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     $this->assertEquals(json_encode($nav_user), $result);
116 116
   }
117 117
   public function testGetAppOrderNoUser() {
118
-    $nav_system= ['/app/calendar/', '/app/tasks/'];
118
+    $nav_system = ['/app/calendar/', '/app/tasks/'];
119 119
     $nav_user = '';
120 120
     $this->service->expects($this->once())
121 121
       ->method('getAppValue')
Please login to merge, or discard this patch.