@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function handle() |
| 45 | 45 | { |
| 46 | - $curTime = microtime(true); |
|
| 46 | + $curTime = microtime(true); |
|
| 47 | 47 | $domain = 'locktest-'.md5(strtolower(config("app.name"))).'@'.strtolower(config("app.name")).".com"; |
| 48 | - $this->line('<fg=default>--------------------------------------------'); |
|
| 48 | + $this->line('<fg=default>--------------------------------------------'); |
|
| 49 | 49 | $this->testConfigurations(); |
| 50 | 50 | $this->line('<fg=default>Testing Mail : <fg=cyan>'.$domain); |
| 51 | 51 | $this->testWrite($domain); |
@@ -60,54 +60,54 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | private function testWrite($domain){ |
| 62 | 62 | $test = new Testing(); |
| 63 | - if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){ |
|
| 64 | - $this->line('<fg=default>Auto Lock : <fg=green>OK'); |
|
| 63 | + if( $test->testWriteEventFailedLogin($domain) AND $test->testWritable($domain)){ |
|
| 64 | + $this->line('<fg=default>Auto Lock : <fg=green>OK'); |
|
| 65 | 65 | } elseif(!$test->testWritable($domain)){ |
| 66 | 66 | $this->success += 1; |
| 67 | 67 | $this->line('<fg=default>Auto Lock : <fg=yellow>Warning (Permission denied)'); |
| 68 | 68 | } else{ |
| 69 | 69 | $this->error += 1; |
| 70 | - $this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
|
| 70 | + $this->line('<fg=default>Auto Lock : <fg=red>Failed'); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 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 | - $this->line('<fg=default>Manual Lock : <fg=green>OK'); |
|
| 77 | + $this->line('<fg=default>Manual Lock : <fg=green>OK'); |
|
| 78 | 78 | } else{ |
| 79 | 79 | $this->error += 1; |
| 80 | - $this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
|
| 80 | + $this->line('<fg=default>Manual Lock : <fg=red>Failed'); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | private function testUnlock($domain){ |
| 84 | 84 | $test = new Testing(); |
| 85 | - if( $test->testUnlocking($domain)){ |
|
| 86 | - $this->success += 1; |
|
| 87 | - $this->line('<fg=default>Unlock Account : <fg=green>OK'); |
|
| 85 | + if( $test->testUnlocking($domain)){ |
|
| 86 | + $this->success += 1; |
|
| 87 | + $this->line('<fg=default>Unlock Account : <fg=green>OK'); |
|
| 88 | 88 | } else{ |
| 89 | - $this->error += 1; |
|
| 90 | - $this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
|
| 89 | + $this->error += 1; |
|
| 90 | + $this->line('<fg=default>Unlock Account : <fg=red>Failed'); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | private function testLocked($domain){ |
| 95 | 95 | $test = new Testing(); |
| 96 | - if( $test->testLockLogin($domain)){ |
|
| 97 | - $this->success += 1; |
|
| 98 | - $this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
|
| 96 | + if( $test->testLockLogin($domain)){ |
|
| 97 | + $this->success += 1; |
|
| 98 | + $this->line('<fg=default>Try Login with locked account : <fg=green>Account is Locked'); |
|
| 99 | 99 | } else{ |
| 100 | - $this->error += 1; |
|
| 101 | - $this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
|
| 100 | + $this->error += 1; |
|
| 101 | + $this->line('<fg=default>Try Login with locked account : <fg=red>Account logged in'); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | private function testConfigurations(){ |
| 106 | - $test = new Testing(); |
|
| 107 | - $res = $test->testConfig(); |
|
| 106 | + $test = new Testing(); |
|
| 107 | + $res = $test->testConfig(); |
|
| 108 | 108 | |
| 109 | - $table = new Table($this->output); |
|
| 110 | - $this->line('<fg=cyan>Testing Config:'); |
|
| 109 | + $table = new Table($this->output); |
|
| 110 | + $this->line('<fg=cyan>Testing Config:'); |
|
| 111 | 111 | $table->setRows([ |
| 112 | 112 | ['<fg=default>login_attemps',isset($res['login_attemps']) ? $res['login_attemps']:"<fg=red>Not Found"], |
| 113 | 113 | ['<fg=default>logging',isset($res['logging']) ? $res['logging']:"<fg=red>Not Found"], |
@@ -132,12 +132,12 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | private function configCheck($res){ |
| 135 | - if($res['err'] > 0){ |
|
| 135 | + if($res['err'] > 0){ |
|
| 136 | 136 | $this->line('<fg=red>Config invalid, testing is canceled.'); |
| 137 | 137 | $this->line('<fg=default>--------------------------------------------'); |
| 138 | 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 | 143 | private function configExists($res){ |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $this->line('<fg=default>--------------------------------------------'); |
| 148 | 148 | $this->line('<fg=default>Tested at: '.date('Y-m-d H:m:s',time())); |
| 149 | 149 | exit(); |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class TestingCommands extends Command |
| 12 | 12 | { |
| 13 | - private $error=0; |
|
| 14 | - private $success=0; |
|
| 13 | + private $error = 0; |
|
| 14 | + private $success = 0; |
|
| 15 | 15 | /** |
| 16 | 16 | * The name and signature of the console command. |
| 17 | 17 | * |
@@ -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 | } |