@@ -52,72 +52,72 @@ discard block |
||
| 52 | 52 | $this->testManualLock($domain); |
| 53 | 53 | $this->testLocked($domain); |
| 54 | 54 | $this->testUnlock($domain); |
| 55 | - $end=time(); |
|
| 55 | + $end = time(); |
|
| 56 | 56 | $this->line('<fg=default>--------------------------------------------'); |
| 57 | - $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time())); |
|
| 58 | - $this->line('<fg=default>Test time : '.(round(microtime(true) - $curTime,3)*1000)." ms"); |
|
| 57 | + $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s', time())); |
|
| 58 | + $this->line('<fg=default>Test time : '.(round(microtime(true)-$curTime, 3) * 1000)." ms"); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | - private function testWrite($domain){ |
|
| 61 | + private function testWrite($domain) { |
|
| 62 | 62 | $test = new Testing(); |
| 63 | - if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){ |
|
| 63 | + if ($test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)) { |
|
| 64 | 64 | $this->line('<fg=default>Auto Lock : <fg=green>OK'); |
| 65 | - } elseif(!$test->testWritable($domain)){ |
|
| 65 | + } elseif (!$test->testWritable($domain)) { |
|
| 66 | 66 | $this->success += 1; |
| 67 | 67 | $this->line('<fg=default>Auto Lock : <fg=yellow>Warning (Permission denied)'); |
| 68 | - } else{ |
|
| 68 | + } else { |
|
| 69 | 69 | $this->error += 1; |
| 70 | 70 | $this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | - private function testManualLock($domain){ |
|
| 73 | + private function testManualLock($domain) { |
|
| 74 | 74 | $test = new Testing(); |
| 75 | - if( $test->testManualLocking($domain)){ |
|
| 75 | + if ($test->testManualLocking($domain)) { |
|
| 76 | 76 | $this->success += 1; |
| 77 | 77 | $this->line('<fg=default>Manual Lock : <fg=green>OK'); |
| 78 | - } else{ |
|
| 78 | + } else { |
|
| 79 | 79 | $this->error += 1; |
| 80 | 80 | $this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - private function testUnlock($domain){ |
|
| 83 | + private function testUnlock($domain) { |
|
| 84 | 84 | $test = new Testing(); |
| 85 | - if( $test->testUnlocking($domain)){ |
|
| 85 | + if ($test->testUnlocking($domain)) { |
|
| 86 | 86 | $this->success += 1; |
| 87 | 87 | $this->line('<fg=default>Unlock Account : <fg=green>OK'); |
| 88 | - } else{ |
|
| 88 | + } else { |
|
| 89 | 89 | $this->error += 1; |
| 90 | 90 | $this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - private function testLocked($domain){ |
|
| 94 | + private function testLocked($domain) { |
|
| 95 | 95 | $test = new Testing(); |
| 96 | - if( $test->testLockLogin($domain)){ |
|
| 96 | + if ($test->testLockLogin($domain)) { |
|
| 97 | 97 | $this->success += 1; |
| 98 | 98 | $this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
| 99 | - } else{ |
|
| 99 | + } else { |
|
| 100 | 100 | $this->error += 1; |
| 101 | 101 | $this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - private function testConfigurations(){ |
|
| 105 | + private function testConfigurations() { |
|
| 106 | 106 | $test = new Testing(); |
| 107 | 107 | $res = $test->testConfig(); |
| 108 | 108 | |
| 109 | 109 | $table = new Table($this->output); |
| 110 | 110 | $this->line('<fg=cyan>Testing Config:'); |
| 111 | 111 | $table->setRows([ |
| 112 | - ['<fg=default>login_attemps',isset($res['login_attemps']) ? $res['login_attemps']:"<fg=red>Not Found"], |
|
| 113 | - ['<fg=default>logging',isset($res['logging']) ? $res['logging']:"<fg=red>Not Found"], |
|
| 114 | - ['<fg=default>input_name',isset($res['input_name']) ? $res['input_name']:"<fg=red>Not Found"], |
|
| 115 | - ['<fg=default>redirect_url',isset($res['redirect_url']) ? $res['redirect_url']:"<fg=red>Not Found"], |
|
| 116 | - ['<fg=default>protected_action_path',isset($res['protected_action_path']) ? $res['protected_action_path']:"<fg=red>Not Found"], |
|
| 117 | - ['<fg=default>protected_middleware_group',isset($res['protected_middleware_group']) ? $res['protected_middleware_group']:"<fg=red>Not Found"], |
|
| 118 | - ['<fg=default>message_name',isset($res['message_name']) ? $res['message_name']:"<fg=red>Not Found"], |
|
| 119 | - ['<fg=default>enable_except_account',isset($res['enable_except_account']) ? $res['enable_except_account']:"<fg=red>Not Found"], |
|
| 120 | - ['<fg=default>except_account',isset($res['except_account']) ? $res['except_account']:"<fg=red>Not Found"], |
|
| 112 | + ['<fg=default>login_attemps', isset($res['login_attemps']) ? $res['login_attemps'] : "<fg=red>Not Found"], |
|
| 113 | + ['<fg=default>logging', isset($res['logging']) ? $res['logging'] : "<fg=red>Not Found"], |
|
| 114 | + ['<fg=default>input_name', isset($res['input_name']) ? $res['input_name'] : "<fg=red>Not Found"], |
|
| 115 | + ['<fg=default>redirect_url', isset($res['redirect_url']) ? $res['redirect_url'] : "<fg=red>Not Found"], |
|
| 116 | + ['<fg=default>protected_action_path', isset($res['protected_action_path']) ? $res['protected_action_path'] : "<fg=red>Not Found"], |
|
| 117 | + ['<fg=default>protected_middleware_group', isset($res['protected_middleware_group']) ? $res['protected_middleware_group'] : "<fg=red>Not Found"], |
|
| 118 | + ['<fg=default>message_name', isset($res['message_name']) ? $res['message_name'] : "<fg=red>Not Found"], |
|
| 119 | + ['<fg=default>enable_except_account', isset($res['enable_except_account']) ? $res['enable_except_account'] : "<fg=red>Not Found"], |
|
| 120 | + ['<fg=default>except_account', isset($res['except_account']) ? $res['except_account'] : "<fg=red>Not Found"], |
|
| 121 | 121 | |
| 122 | 122 | ]); |
| 123 | 123 | $table->render(); |
@@ -125,27 +125,27 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - private function errorCheck($res){ |
|
| 128 | + private function errorCheck($res) { |
|
| 129 | 129 | $this->configExists($res); |
| 130 | 130 | $this->configCheck($res); |
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - private function configCheck($res){ |
|
| 135 | - if($res['err'] > 0){ |
|
| 134 | + private function configCheck($res) { |
|
| 135 | + if ($res['err'] > 0) { |
|
| 136 | 136 | $this->line('<fg=red>Config invalid, testing is canceled.'); |
| 137 | 137 | $this->line('<fg=default>--------------------------------------------'); |
| 138 | - $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time())); |
|
| 138 | + $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s', time())); |
|
| 139 | 139 | exit(); |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - private function configExists($res){ |
|
| 144 | - if($res['err'] > 0 AND !empty($res['file'])){ |
|
| 143 | + private function configExists($res) { |
|
| 144 | + if ($res['err'] > 0 AND !empty($res['file'])) { |
|
| 145 | 145 | $this->line('<fg=red>Testing config failed, testing is canceled.'); |
| 146 | 146 | $this->line($res['file']); |
| 147 | 147 | $this->line('<fg=default>--------------------------------------------'); |
| 148 | - $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time())); |
|
| 148 | + $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s', time())); |
|
| 149 | 149 | exit(); |
| 150 | 150 | } |
| 151 | 151 | } |