ちんこ
諏訪子 <suwako@076.moe>、2025-12-22 20:45
コミット 3b96986a8526368852a8ec596882803d06ca7d53
・親 3a7bbb6
・ファイルを見る
6個のファイル、+368 -353
| @@ -37,6 +37,7 @@ | ||
| 37 | 37 | define('ACTIVITYPUB_ENABLED', false); |
| 38 | 38 | define('MYSQL_ENABLED', false); |
| 39 | 39 | define('CSV_ENABLED', false); |
| 40 | +define('CURL_ENABLED', true); | |
| 40 | 41 | define('AUTH_ENABLED', false); |
| 41 | 42 | define('AUTH_REGISTER_ENABLED', false); |
| 42 | 43 | define('COPYRIGHT_YEAR', '2018-'.date('Y')); |
| @@ -6,218 +6,224 @@ | ||
| 6 | 6 | use Site\Lib\Tester; |
| 7 | 7 | use Site\Lib\Auth; |
| 8 | 8 | |
| 9 | -$test = new Tester([ | |
| 10 | - 'colorOutput' => true, | |
| 11 | - 'verboseOutput' => true | |
| 12 | -]); | |
| 9 | +if (AUTH_ENABLED) { | |
| 10 | + $test = new Tester([ | |
| 11 | + 'colorOutput' => true, | |
| 12 | + 'verboseOutput' => true | |
| 13 | + ]); | |
| 13 | 14 | |
| 14 | -$test->describe('ユーザー登録', function($test): void { | |
| 15 | - $test->it('アカウントを作成出来るはず', function($test): void { | |
| 16 | - $user = "admin1234"; | |
| 17 | - $pass = "testTEST1234!#$%@[]:;"; | |
| 18 | - $passVerify = "testTEST1234!#$%@[]:;"; | |
| 19 | - $email = "test@076.co.jp"; | |
| 15 | + if (AUTH_REGISTER_ENABLED) { | |
| 16 | + $test->describe('ユーザー登録', function($test): void { | |
| 17 | + $test->it('アカウントを作成出来るはず', function($test): void { | |
| 18 | + $user = "admin1234"; | |
| 19 | + $pass = "testTEST1234!#$%@[]:;"; | |
| 20 | + $passVerify = "testTEST1234!#$%@[]:;"; | |
| 21 | + $email = "test@076.co.jp"; | |
| 20 | 22 | |
| 21 | - $auth = new Auth(); | |
| 22 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 23 | + $auth = new Auth(); | |
| 24 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 23 | 25 | |
| 24 | - $expect = true; | |
| 26 | + $expect = true; | |
| 25 | 27 | |
| 26 | - $test->assertNotNull($res); | |
| 27 | - $test->assertEquals($res->isSuccess, $expect); | |
| 28 | - }); | |
| 28 | + $test->assertNotNull($res); | |
| 29 | + $test->assertEquals($res->isSuccess, $expect); | |
| 30 | + }); | |
| 29 | 31 | |
| 30 | - $test->it('空フィールドでアカウントを作成出来ないはず', function($test): void { | |
| 31 | - $user = ""; | |
| 32 | - $pass = "testTEST1234!#$%@[]:;"; | |
| 33 | - $passVerify = "testTEST1234!#$%@[]:;"; | |
| 34 | - $email = "test@076.ne.jp"; | |
| 32 | + $test->it('空フィールドでアカウントを作成出来ないはず', function($test): void { | |
| 33 | + $user = ""; | |
| 34 | + $pass = "testTEST1234!#$%@[]:;"; | |
| 35 | + $passVerify = "testTEST1234!#$%@[]:;"; | |
| 36 | + $email = "test@076.ne.jp"; | |
| 35 | 37 | |
| 36 | - $auth = new Auth(); | |
| 37 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 38 | + $auth = new Auth(); | |
| 39 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 38 | 40 | |
| 39 | - $expect = 'エラー:ユーザー名をご入力下さい。'.'<br />'; | |
| 41 | + $expect = 'エラー:ユーザー名をご入力下さい。'.'<br />'; | |
| 40 | 42 | |
| 41 | - $test->assertNotNull($res); | |
| 42 | - $test->assertEquals($res->message, $expect); | |
| 43 | + $test->assertNotNull($res); | |
| 44 | + $test->assertEquals($res->message, $expect); | |
| 43 | 45 | |
| 44 | - $user = "admin5678"; | |
| 45 | - $pass = ""; | |
| 46 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 46 | + $user = "admin5678"; | |
| 47 | + $pass = ""; | |
| 48 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 47 | 49 | |
| 48 | - $expect = 'エラー:パスワードをご入力下さい。'.'<br />'; | |
| 50 | + $expect = 'エラー:パスワードをご入力下さい。'.'<br />'; | |
| 49 | 51 | |
| 50 | - $test->assertNotNull($res); | |
| 51 | - $test->assertEquals($res->message, $expect); | |
| 52 | + $test->assertNotNull($res); | |
| 53 | + $test->assertEquals($res->message, $expect); | |
| 52 | 54 | |
| 53 | - $pass = "testTEST1234!#$%@[]:;"; | |
| 54 | - $email = ""; | |
| 55 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 55 | + $pass = "testTEST1234!#$%@[]:;"; | |
| 56 | + $email = ""; | |
| 57 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 56 | 58 | |
| 57 | - $expect = 'エラー:メールアドレスをご入力下さい。'.'<br />'; | |
| 59 | + $expect = 'エラー:メールアドレスをご入力下さい。'.'<br />'; | |
| 58 | 60 | |
| 59 | - $test->assertNotNull($res); | |
| 60 | - $test->assertEquals($res->message, $expect); | |
| 61 | - }); | |
| 61 | + $test->assertNotNull($res); | |
| 62 | + $test->assertEquals($res->message, $expect); | |
| 63 | + }); | |
| 62 | 64 | |
| 63 | - $test->it('既にユーザー名やメールアドレスが存在するアカウントを作成出来ないはず', function($test): void { | |
| 64 | - $user = "admin1234"; | |
| 65 | - $pass = "testTEST1234!#$%@[]:;"; | |
| 66 | - $passVerify = "testTEST1234!#$%@[]:;"; | |
| 67 | - $email = "test@076.ne.jp"; | |
| 65 | + $test->it('既にユーザー名やメールアドレスが存在するアカウントを作成出来ないはず', function($test): void { | |
| 66 | + $user = "admin1234"; | |
| 67 | + $pass = "testTEST1234!#$%@[]:;"; | |
| 68 | + $passVerify = "testTEST1234!#$%@[]:;"; | |
| 69 | + $email = "test@076.ne.jp"; | |
| 68 | 70 | |
| 69 | - $auth = new Auth(); | |
| 70 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 71 | + $auth = new Auth(); | |
| 72 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 71 | 73 | |
| 72 | - $expect = 'ユーザー「admin1234」は既に存在します。'.'<br />'; | |
| 74 | + $expect = 'ユーザー「admin1234」は既に存在します。'.'<br />'; | |
| 73 | 75 | |
| 74 | - $test->assertNotNull($res); | |
| 75 | - $test->assertEquals($res->message, $expect); | |
| 76 | + $test->assertNotNull($res); | |
| 77 | + $test->assertEquals($res->message, $expect); | |
| 76 | 78 | |
| 77 | - $user = "admin5678"; | |
| 78 | - $email = "test@076.co.jp"; | |
| 79 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 79 | + $user = "admin5678"; | |
| 80 | + $email = "test@076.co.jp"; | |
| 81 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 80 | 82 | |
| 81 | - $expect = 'ユーザー「test@076.co.jp」は既に存在します。'.'<br />'; | |
| 83 | + $expect = 'ユーザー「test@076.co.jp」は既に存在します。'.'<br />'; | |
| 82 | 84 | |
| 83 | - $test->assertNotNull($res); | |
| 84 | - $test->assertEquals($res->message, $expect); | |
| 85 | - }); | |
| 85 | + $test->assertNotNull($res); | |
| 86 | + $test->assertEquals($res->message, $expect); | |
| 87 | + }); | |
| 86 | 88 | |
| 87 | - $test->it('一致しない、短い、又は不安なパスワードでアカウントを作成出来ないはず', function($test): void { | |
| 88 | - $user = "admin5678"; | |
| 89 | - $pass = "testtest1234!#$%@[]:;"; | |
| 90 | - $passVerify = "testTEST1234!#$%@[]:;"; | |
| 91 | - $email = "test@076.ne.jp"; | |
| 89 | + $test->it('一致しない、短い、又は不安なパスワードでアカウントを作成出来ないはず', function($test): void { | |
| 90 | + $user = "admin5678"; | |
| 91 | + $pass = "testtest1234!#$%@[]:;"; | |
| 92 | + $passVerify = "testTEST1234!#$%@[]:;"; | |
| 93 | + $email = "test@076.ne.jp"; | |
| 92 | 94 | |
| 93 | - $auth = new Auth(); | |
| 94 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 95 | + $auth = new Auth(); | |
| 96 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 95 | 97 | |
| 96 | - $expect = 'エラー:パスワードは一致していません。'.'<br />'; | |
| 98 | + $expect = 'エラー:パスワードは一致していません。'.'<br />'; | |
| 97 | 99 | |
| 98 | - $test->assertNotNull($res); | |
| 99 | - $test->assertEquals($res->message, $expect); | |
| 100 | + $test->assertNotNull($res); | |
| 101 | + $test->assertEquals($res->message, $expect); | |
| 100 | 102 | |
| 101 | - $pass = "testTEST1234"; | |
| 102 | - $passVerify = "testTEST1234"; | |
| 103 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 103 | + $pass = "testTEST1234"; | |
| 104 | + $passVerify = "testTEST1234"; | |
| 105 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 104 | 106 | |
| 105 | - $expect = 'エラー:パスワードは20以上をご入力下さい。'.'<br />'; | |
| 107 | + $expect = 'エラー:パスワードは20以上をご入力下さい。'.'<br />'; | |
| 106 | 108 | |
| 107 | - $test->assertNotNull($res); | |
| 108 | - $test->assertEquals($res->message, $expect); | |
| 109 | + $test->assertNotNull($res); | |
| 110 | + $test->assertEquals($res->message, $expect); | |
| 109 | 111 | |
| 110 | - $pass = "testTEST1234testTEST"; | |
| 111 | - $passVerify = "testTEST1234testTEST"; | |
| 112 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 112 | + $pass = "testTEST1234testTEST"; | |
| 113 | + $passVerify = "testTEST1234testTEST"; | |
| 114 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 113 | 115 | |
| 114 | - $expect = 'エラー:パスワードは2つ以上の大文字、2つ以上の小文字、2つ以上の数字、及び2つ以上の特別文字を含む事が必須です。'.'<br />'; | |
| 116 | + $expect = 'エラー:パスワードは2つ以上の大文字、2つ以上の小文字、2つ以上の数字、及び2つ以上の特別文字を含む事が必須です。'.'<br />'; | |
| 115 | 117 | |
| 116 | - $test->assertNotNull($res); | |
| 117 | - $test->assertEquals($res->message, $expect); | |
| 118 | - }); | |
| 118 | + $test->assertNotNull($res); | |
| 119 | + $test->assertEquals($res->message, $expect); | |
| 120 | + }); | |
| 119 | 121 | |
| 120 | - $test->it('不正なメールアドレスでアカウントを作成出来ないはず', function($test): void { | |
| 121 | - $user = "admin5678"; | |
| 122 | - $pass = "testTEST1234!#$%@[]:;"; | |
| 123 | - $passVerify = "testTEST1234!#$%@[]:;"; | |
| 124 | - $email = "test@076.niggerballs"; | |
| 122 | + $test->it('不正なメールアドレスでアカウントを作成出来ないはず', function($test): void { | |
| 123 | + $user = "admin5678"; | |
| 124 | + $pass = "testTEST1234!#$%@[]:;"; | |
| 125 | + $passVerify = "testTEST1234!#$%@[]:;"; | |
| 126 | + $email = "test@076.niggerballs"; | |
| 125 | 127 | |
| 126 | - $auth = new Auth(); | |
| 127 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 128 | + $auth = new Auth(); | |
| 129 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 128 | 130 | |
| 129 | - $expect = 'エラー:メールアドレスは不正です。'.'<br />'; | |
| 131 | + $expect = 'エラー:メールアドレスは不正です。'.'<br />'; | |
| 130 | 132 | |
| 131 | - $test->assertNotNull($res); | |
| 132 | - $test->assertEquals($res->message, $expect); | |
| 133 | + $test->assertNotNull($res); | |
| 134 | + $test->assertEquals($res->message, $expect); | |
| 133 | 135 | |
| 134 | - $email = "test@076"; | |
| 135 | - $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 136 | + $email = "test@076"; | |
| 137 | + $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 136 | 138 | |
| 137 | - $expect = 'エラー:メールアドレスは不正です。'.'<br />'; | |
| 139 | + $expect = 'エラー:メールアドレスは不正です。'.'<br />'; | |
| 138 | 140 | |
| 139 | - $test->assertNotNull($res); | |
| 140 | - $test->assertEquals($res->message, $expect); | |
| 141 | - }); | |
| 141 | + $test->assertNotNull($res); | |
| 142 | + $test->assertEquals($res->message, $expect); | |
| 143 | + }); | |
| 142 | 144 | |
| 143 | - // ユーザーの削除 | |
| 144 | - $users = scandir(ROOT.'/data/user'); | |
| 145 | - $userFile = ''; | |
| 146 | - foreach ($users as $u) { | |
| 147 | - if (str_contains($u, 'admin1234')) { | |
| 148 | - $userFile = $u; | |
| 149 | - break; | |
| 150 | - } | |
| 145 | + // ユーザーの削除 | |
| 146 | + $users = scandir(ROOT.'/data/user'); | |
| 147 | + $userFile = ''; | |
| 148 | + foreach ($users as $u) { | |
| 149 | + if (str_contains($u, 'admin1234')) { | |
| 150 | + $userFile = $u; | |
| 151 | + break; | |
| 152 | + } | |
| 153 | + } | |
| 154 | + unlink(ROOT.'/data/user/'.$userFile); | |
| 155 | + rmdir(ROOT.'/public/static/user/admin1234'); | |
| 156 | + }); | |
| 151 | 157 | } |
| 152 | - unlink(ROOT.'/data/user/'.$userFile); | |
| 153 | - rmdir(ROOT.'/public/static/user/admin1234'); | |
| 154 | -}); | |
| 155 | 158 | |
| 156 | -// TODO: CLIからクッキーを設定出来ないから、「Site\Lib\Auth::getUserData(): Return value must be of type stdClass, null returned」って発生する・・・ | |
| 157 | -// $test->describe('ログインとログアウト', function($test): void { | |
| 158 | -// $user = "admin1234"; | |
| 159 | -// $pass = "testTEST1234!#$%@[]:;"; | |
| 160 | -// $passVerify = "testTEST1234!#$%@[]:;"; | |
| 161 | -// $email = "test@076.co.jp"; | |
| 159 | + // TODO: CLIからクッキーを設定出来ないから、「Site\Lib\Auth::getUserData(): Return value must be of type stdClass, null returned」って発生する・・・ | |
| 160 | + // $test->describe('ログインとログアウト', function($test): void { | |
| 161 | + // $user = "admin1234"; | |
| 162 | + // $pass = "testTEST1234!#$%@[]:;"; | |
| 163 | + // $passVerify = "testTEST1234!#$%@[]:;"; | |
| 164 | + // $email = "test@076.co.jp"; | |
| 162 | 165 | |
| 163 | -// $auth = new Auth(); | |
| 164 | -// $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 165 | -// unset($auth); | |
| 166 | + // $auth = new Auth(); | |
| 167 | + // $res = $auth->mkUser($user, $pass, $passVerify, $email); | |
| 168 | + // unset($auth); | |
| 166 | 169 | |
| 167 | -// $test->it('正しい認証情報でログイン出来るはず', function($test) use ($user, $pass): void { | |
| 168 | -// $auth = new Auth(); | |
| 169 | -// $res = $auth->setToken($user, $pass); | |
| 170 | + // $test->it('正しい認証情報でログイン出来るはず', function($test) use ($user, $pass): void { | |
| 171 | + // $auth = new Auth(); | |
| 172 | + // $res = $auth->setToken($user, $pass); | |
| 170 | 173 | |
| 171 | -// $test->assertTrue($res->isSuccess); | |
| 172 | -// $test->assertEquals('ログイン成功', $res->message); | |
| 174 | + // $test->assertTrue($res->isSuccess); | |
| 175 | + // $test->assertEquals('ログイン成功', $res->message); | |
| 173 | 176 | |
| 174 | -// $auth2 = new Auth(); | |
| 175 | -// $usr = $auth2->getLoggedInUser(); | |
| 177 | + // $auth2 = new Auth(); | |
| 178 | + // $usr = $auth2->getLoggedInUser(); | |
| 176 | 179 | |
| 177 | -// $test->assertNotNull($usr); | |
| 178 | -// $test->assertEquals($user, $usr->username); | |
| 179 | -// }); | |
| 180 | + // $test->assertNotNull($usr); | |
| 181 | + // $test->assertEquals($user, $usr->username); | |
| 182 | + // }); | |
| 180 | 183 | |
| 181 | -// $test->it('間違ったパスワードでログイン出来ないはず', function($test) use ($user): void { | |
| 182 | -// $auth = new Auth(); | |
| 183 | -// $res = $auth->setToken($user, 'fuseipassword'); | |
| 184 | + // $test->it('間違ったパスワードでログイン出来ないはず', function($test) use ($user): void { | |
| 185 | + // $auth = new Auth(); | |
| 186 | + // $res = $auth->setToken($user, 'fuseipassword'); | |
| 184 | 187 | |
| 185 | -// $test->assertFalse($res->isSuccess); | |
| 186 | -// $test->assertEquals('ユーザー名又はパスワードが一致していません', $res->message); | |
| 187 | -// }); | |
| 188 | + // $test->assertFalse($res->isSuccess); | |
| 189 | + // $test->assertEquals('ユーザー名又はパスワードが一致していません', $res->message); | |
| 190 | + // }); | |
| 188 | 191 | |
| 189 | -// $test->it('存在しないユーザーでログイン出来ないはず', function($test) use ($pass): void { | |
| 190 | -// $auth = new Auth(); | |
| 191 | -// $res = $auth->setToken('fumeiuser', $pass); | |
| 192 | + // $test->it('存在しないユーザーでログイン出来ないはず', function($test) use ($pass): void { | |
| 193 | + // $auth = new Auth(); | |
| 194 | + // $res = $auth->setToken('fumeiuser', $pass); | |
| 192 | 195 | |
| 193 | -// $test->assertFalse($res->isSuccess); | |
| 194 | -// $test->assertEquals('ユーザー名又はパスワードが一致していません', $res->message); | |
| 195 | -// }); | |
| 196 | + // $test->assertFalse($res->isSuccess); | |
| 197 | + // $test->assertEquals('ユーザー名又はパスワードが一致していません', $res->message); | |
| 198 | + // }); | |
| 196 | 199 | |
| 197 | -// $test->it('ログアウト出来るはず', function($test) use ($user, $pass): void { | |
| 198 | -// $auth = new Auth(); | |
| 199 | -// $auth->setToken($user, $pass); | |
| 200 | + // $test->it('ログアウト出来るはず', function($test) use ($user, $pass): void { | |
| 201 | + // $auth = new Auth(); | |
| 202 | + // $auth->setToken($user, $pass); | |
| 200 | 203 | |
| 201 | -// $res = $auth->logout(); | |
| 204 | + // $res = $auth->logout(); | |
| 202 | 205 | |
| 203 | -// $test->assertTrue($res->isSuccess); | |
| 204 | -// $test->assertEquals('ログイン成功', $res->message); | |
| 206 | + // $test->assertTrue($res->isSuccess); | |
| 207 | + // $test->assertEquals('ログイン成功', $res->message); | |
| 205 | 208 | |
| 206 | -// $auth2 = new Auth(); | |
| 207 | -// $usr = $auth2->getLoggedInUser(); | |
| 209 | + // $auth2 = new Auth(); | |
| 210 | + // $usr = $auth2->getLoggedInUser(); | |
| 208 | 211 | |
| 209 | -// $test->assertNull($usr); | |
| 210 | -// }); | |
| 212 | + // $test->assertNull($usr); | |
| 213 | + // }); | |
| 211 | 214 | |
| 212 | -// // ユーザーの削除 | |
| 213 | -// $users = scandir(ROOT.'/data/user'); | |
| 214 | -// $userFile = ''; | |
| 215 | -// foreach ($users as $u) { | |
| 216 | -// if (str_contains($u, 'admin1234')) { | |
| 217 | -// $userFile = $u; | |
| 218 | -// break; | |
| 219 | -// } | |
| 220 | -// } | |
| 221 | -// unlink(ROOT.'/data/user/'.$userFile); | |
| 222 | -// rmdir(ROOT.'/public/static/user/admin1234'); | |
| 223 | -// }); | |
| 215 | + // // ユーザーの削除 | |
| 216 | + // $users = scandir(ROOT.'/data/user'); | |
| 217 | + // $userFile = ''; | |
| 218 | + // foreach ($users as $u) { | |
| 219 | + // if (str_contains($u, 'admin1234')) { | |
| 220 | + // $userFile = $u; | |
| 221 | + // break; | |
| 222 | + // } | |
| 223 | + // } | |
| 224 | + // unlink(ROOT.'/data/user/'.$userFile); | |
| 225 | + // rmdir(ROOT.'/public/static/user/admin1234'); | |
| 226 | + // }); | |
| 227 | + | |
| 228 | + $test->printSummary(); | |
| 229 | +} |
| @@ -7,116 +7,120 @@ | ||
| 7 | 7 | use Site\Lib\Csv; |
| 8 | 8 | use Site\Lib\Delimiter; |
| 9 | 9 | |
| 10 | -$test = new Tester([ | |
| 11 | - 'colorOutput' => true, | |
| 12 | - 'verboseOutput' => true | |
| 13 | -]); | |
| 10 | +if (CSV_ENABLED) { | |
| 11 | + $test = new Tester([ | |
| 12 | + 'colorOutput' => true, | |
| 13 | + 'verboseOutput' => true | |
| 14 | + ]); | |
| 14 | 15 | |
| 15 | -$test->describe('Csvの基本的なパーシング', function($test): void { | |
| 16 | - $test->it('簡単なCSVファイルをパーシングするはず', function($test): void { | |
| 17 | - $str = "岩田聡,プロジューサー\n宮本茂,デザイナー\nJeffrey Epstein,幼児性愛者"; | |
| 16 | + $test->describe('Csvの基本的なパーシング', function($test): void { | |
| 17 | + $test->it('簡単なCSVファイルをパーシングするはず', function($test): void { | |
| 18 | + $str = "岩田聡,プロジューサー\n宮本茂,デザイナー\nJeffrey Epstein,幼児性愛者"; | |
| 18 | 19 | |
| 19 | - $tmpFile = tempnam(sys_get_temp_dir(), 'csv_test'); | |
| 20 | - file_put_contents($tmpFile, $str); | |
| 20 | + $tmpFile = tempnam(sys_get_temp_dir(), 'csv_test'); | |
| 21 | + file_put_contents($tmpFile, $str); | |
| 21 | 22 | |
| 22 | - $csv = new Csv($tmpFile); | |
| 23 | - $res = $csv->parse(); | |
| 23 | + $csv = new Csv($tmpFile); | |
| 24 | + $res = $csv->parse(); | |
| 24 | 25 | |
| 25 | - unlink($tmpFile); | |
| 26 | + unlink($tmpFile); | |
| 26 | 27 | |
| 27 | - $expect = [ | |
| 28 | - ["岩田聡", "プロジューサー"], | |
| 29 | - ["宮本茂", "デザイナー"], | |
| 30 | - ["Jeffrey Epstein", "幼児性愛者"] | |
| 31 | - ]; | |
| 28 | + $expect = [ | |
| 29 | + ["岩田聡", "プロジューサー"], | |
| 30 | + ["宮本茂", "デザイナー"], | |
| 31 | + ["Jeffrey Epstein", "幼児性愛者"] | |
| 32 | + ]; | |
| 32 | 33 | |
| 33 | - $test->assertNotNull($res); | |
| 34 | - $test->assertEquals($res, $expect); | |
| 35 | - }); | |
| 34 | + $test->assertNotNull($res); | |
| 35 | + $test->assertEquals($res, $expect); | |
| 36 | + }); | |
| 36 | 37 | |
| 37 | - $test->it('異なるデリミタでCSVをパーシングするはず', function ($test): void { | |
| 38 | - // セミコロン | |
| 39 | - $semiStr = "岩田聡;プロジューサー\n宮本茂;デザイナー"; | |
| 40 | - $tmpFile = tempnam(sys_get_temp_dir(), 'csv_semi_test'); | |
| 41 | - file_put_contents($tmpFile, $semiStr); | |
| 38 | + $test->it('異なるデリミタでCSVをパーシングするはず', function ($test): void { | |
| 39 | + // セミコロン | |
| 40 | + $semiStr = "岩田聡;プロジューサー\n宮本茂;デザイナー"; | |
| 41 | + $tmpFile = tempnam(sys_get_temp_dir(), 'csv_semi_test'); | |
| 42 | + file_put_contents($tmpFile, $semiStr); | |
| 42 | 43 | |
| 43 | - $csv = new Csv($tmpFile); | |
| 44 | - $res = $csv->parse(Delimiter::SEMICOLON); | |
| 44 | + $csv = new Csv($tmpFile); | |
| 45 | + $res = $csv->parse(Delimiter::SEMICOLON); | |
| 45 | 46 | |
| 46 | - unlink($tmpFile); | |
| 47 | + unlink($tmpFile); | |
| 47 | 48 | |
| 48 | - $expect = [ | |
| 49 | - ["岩田聡", "プロジューサー"], | |
| 50 | - ["宮本茂", "デザイナー"] | |
| 51 | - ]; | |
| 49 | + $expect = [ | |
| 50 | + ["岩田聡", "プロジューサー"], | |
| 51 | + ["宮本茂", "デザイナー"] | |
| 52 | + ]; | |
| 52 | 53 | |
| 53 | - $test->assertEquals($res, $expect, "セミコロンデリミタでパーシングに失敗"); | |
| 54 | + $test->assertEquals($res, $expect, "セミコロンデリミタでパーシングに失敗"); | |
| 54 | 55 | |
| 55 | - // タブ | |
| 56 | - $tabStr = "岩田聡\tプロジューサー\n宮本茂\tデザイナー"; | |
| 57 | - $tmpFile = tempnam(sys_get_temp_dir(), 'csv_tab_test'); | |
| 58 | - file_put_contents($tmpFile, $tabStr); | |
| 56 | + // タブ | |
| 57 | + $tabStr = "岩田聡\tプロジューサー\n宮本茂\tデザイナー"; | |
| 58 | + $tmpFile = tempnam(sys_get_temp_dir(), 'csv_tab_test'); | |
| 59 | + file_put_contents($tmpFile, $tabStr); | |
| 59 | 60 | |
| 60 | - $csv = new Csv($tmpFile); | |
| 61 | - $res = $csv->parse(Delimiter::TAB); | |
| 61 | + $csv = new Csv($tmpFile); | |
| 62 | + $res = $csv->parse(Delimiter::TAB); | |
| 62 | 63 | |
| 63 | - unlink($tmpFile); | |
| 64 | + unlink($tmpFile); | |
| 64 | 65 | |
| 65 | - $test->assertEquals($res, $expect, "タブデリミタでパーシングに失敗"); | |
| 66 | + $test->assertEquals($res, $expect, "タブデリミタでパーシングに失敗"); | |
| 66 | 67 | |
| 67 | - // パイプ | |
| 68 | - $pipeStr = "岩田聡|プロジューサー\n宮本茂|デザイナー"; | |
| 69 | - $tmpFile = tempnam(sys_get_temp_dir(), 'csv_pipe_test'); | |
| 70 | - file_put_contents($tmpFile, $pipeStr); | |
| 68 | + // パイプ | |
| 69 | + $pipeStr = "岩田聡|プロジューサー\n宮本茂|デザイナー"; | |
| 70 | + $tmpFile = tempnam(sys_get_temp_dir(), 'csv_pipe_test'); | |
| 71 | + file_put_contents($tmpFile, $pipeStr); | |
| 71 | 72 | |
| 72 | - $csv = new Csv($tmpFile); | |
| 73 | - $res = $csv->parse(Delimiter::PIPE); | |
| 73 | + $csv = new Csv($tmpFile); | |
| 74 | + $res = $csv->parse(Delimiter::PIPE); | |
| 74 | 75 | |
| 75 | - unlink($tmpFile); | |
| 76 | + unlink($tmpFile); | |
| 76 | 77 | |
| 77 | - $test->assertEquals($res, $expect, "パイプデリミタでパーシングに失敗"); | |
| 78 | - }); | |
| 78 | + $test->assertEquals($res, $expect, "パイプデリミタでパーシングに失敗"); | |
| 79 | + }); | |
| 79 | 80 | |
| 80 | - $test->it('ヘッダー付きCSVをパーシングするはず', function ($test) { | |
| 81 | - $str = "name,job title\n岩田聡,プロジューサー\n宮本茂,デザイナー"; | |
| 81 | + $test->it('ヘッダー付きCSVをパーシングするはず', function ($test) { | |
| 82 | + $str = "name,job title\n岩田聡,プロジューサー\n宮本茂,デザイナー"; | |
| 82 | 83 | |
| 83 | - $tmpFile = tempnam(sys_get_temp_dir(), 'csv_header_test'); | |
| 84 | - file_put_contents($tmpFile, $str); | |
| 84 | + $tmpFile = tempnam(sys_get_temp_dir(), 'csv_header_test'); | |
| 85 | + file_put_contents($tmpFile, $str); | |
| 85 | 86 | |
| 86 | - $csv = new Csv($tmpFile); | |
| 87 | - $res = $csv->parse(Delimiter::COMMA, true); // isHeader = true | |
| 87 | + $csv = new Csv($tmpFile); | |
| 88 | + $res = $csv->parse(Delimiter::COMMA, true); // isHeader = true | |
| 88 | 89 | |
| 89 | - unlink($tmpFile); | |
| 90 | + unlink($tmpFile); | |
| 90 | 91 | |
| 91 | - $expect = [ | |
| 92 | - 'header' => ["name", "job title"], | |
| 93 | - 'body' => [ | |
| 94 | - ["岩田聡", "プロジューサー"], | |
| 95 | - ["宮本茂", "デザイナー"], | |
| 96 | - ], | |
| 97 | - ]; | |
| 92 | + $expect = [ | |
| 93 | + 'header' => ["name", "job title"], | |
| 94 | + 'body' => [ | |
| 95 | + ["岩田聡", "プロジューサー"], | |
| 96 | + ["宮本茂", "デザイナー"], | |
| 97 | + ], | |
| 98 | + ]; | |
| 98 | 99 | |
| 99 | - $test->assertNotNull($res); | |
| 100 | - $test->assertEquals($res, $expect, "ヘッダーパーシングに失敗"); | |
| 101 | - }); | |
| 100 | + $test->assertNotNull($res); | |
| 101 | + $test->assertEquals($res, $expect, "ヘッダーパーシングに失敗"); | |
| 102 | + }); | |
| 102 | 103 | |
| 103 | - $test->it('セル内にカンマを含むCSVをパーシングするはず', function ($test): void { | |
| 104 | - $str = "\"守矢, 諏訪子\",エンジニア\n\"青, 猫ちゃん\",サーバー管理者"; | |
| 104 | + $test->it('セル内にカンマを含むCSVをパーシングするはず', function ($test): void { | |
| 105 | + $str = "\"守矢, 諏訪子\",エンジニア\n\"青, 猫ちゃん\",サーバー管理者"; | |
| 105 | 106 | |
| 106 | - $tmpFile = tempnam(sys_get_temp_dir(), 'csv_quoted_comma_test'); | |
| 107 | - file_put_contents($tmpFile, $str); | |
| 107 | + $tmpFile = tempnam(sys_get_temp_dir(), 'csv_quoted_comma_test'); | |
| 108 | + file_put_contents($tmpFile, $str); | |
| 108 | 109 | |
| 109 | - $csv = new Csv($tmpFile); | |
| 110 | - $res = $csv->parse(\Site\Lib\delimiter::COMMA); | |
| 110 | + $csv = new Csv($tmpFile); | |
| 111 | + $res = $csv->parse(\Site\Lib\delimiter::COMMA); | |
| 111 | 112 | |
| 112 | - unlink($tmpFile); | |
| 113 | + unlink($tmpFile); | |
| 113 | 114 | |
| 114 | - $expect = [ | |
| 115 | - ["守矢, 諏訪子", "エンジニア"], | |
| 116 | - ["青, 猫ちゃん", "サーバー管理者"] | |
| 117 | - ]; | |
| 115 | + $expect = [ | |
| 116 | + ["守矢, 諏訪子", "エンジニア"], | |
| 117 | + ["青, 猫ちゃん", "サーバー管理者"] | |
| 118 | + ]; | |
| 118 | 119 | |
| 119 | - $test->assertNotNull($res); | |
| 120 | - $test->assertEquals($res, $expect, "セル内にカンマを含むパーシングに失敗"); | |
| 120 | + $test->assertNotNull($res); | |
| 121 | + $test->assertEquals($res, $expect, "セル内にカンマを含むパーシングに失敗"); | |
| 122 | + }); | |
| 121 | 123 | }); |
| 122 | -}); | |
| 124 | + | |
| 125 | + $test->printSummary(); | |
| 126 | +} |
| @@ -6,87 +6,89 @@ | ||
| 6 | 6 | use Site\Lib\Tester; |
| 7 | 7 | use Site\Lib\Curl; |
| 8 | 8 | |
| 9 | -$test = new Tester([ | |
| 10 | - 'colorOutput' => true, | |
| 11 | - 'verboseOutput' => true | |
| 12 | -]); | |
| 9 | +if (CURL_ENABLED) { | |
| 10 | + $test = new Tester([ | |
| 11 | + 'colorOutput' => true, | |
| 12 | + 'verboseOutput' => true | |
| 13 | + ]); | |
| 13 | 14 | |
| 14 | -$test->describe('Curlの基本的な機能性', function($test): void { | |
| 15 | - $test->it('URLで使って新しいインスタンスを作成するはず', function($test): void { | |
| 16 | - $curl = new Curl('https://076.moe'); | |
| 17 | - $test->assertNotNull($curl); | |
| 18 | - }); | |
| 15 | + $test->describe('Curlの基本的な機能性', function($test): void { | |
| 16 | + $test->it('URLで使って新しいインスタンスを作成するはず', function($test): void { | |
| 17 | + $curl = new Curl('https://076.moe'); | |
| 18 | + $test->assertNotNull($curl); | |
| 19 | + }); | |
| 19 | 20 | |
| 20 | - $test->it('メソッドでURLを設定出来るはす', function($test): void { | |
| 21 | - $curl = new Curl(); | |
| 22 | - $curl->setUrl('https://076.moe'); | |
| 23 | - $test->assertNotNull($curl); | |
| 24 | - }); | |
| 21 | + $test->it('メソッドでURLを設定出来るはす', function($test): void { | |
| 22 | + $curl = new Curl(); | |
| 23 | + $curl->setUrl('https://076.moe'); | |
| 24 | + $test->assertNotNull($curl); | |
| 25 | + }); | |
| 25 | 26 | |
| 26 | - $test->it('ヘッダー文字を作成出来るはず', function($test): void { | |
| 27 | - $curl = new Curl('https://076.moe'); | |
| 28 | - $curl->setHeaders([ | |
| 29 | - 'Accept' => 'application/json', | |
| 30 | - 'User-Agent' => 'LoliTest/1.0' | |
| 31 | - ]); | |
| 27 | + $test->it('ヘッダー文字を作成出来るはず', function($test): void { | |
| 28 | + $curl = new Curl('https://076.moe'); | |
| 29 | + $curl->setHeaders([ | |
| 30 | + 'Accept' => 'application/json', | |
| 31 | + 'User-Agent' => 'LoliTest/1.0' | |
| 32 | + ]); | |
| 32 | 33 | |
| 33 | - $reflectionClass = new \ReflectionClass($curl); | |
| 34 | - $method = $reflectionClass->getMethod('buildHeaderString'); | |
| 35 | - $method->setAccessible(true); | |
| 34 | + $reflectionClass = new \ReflectionClass($curl); | |
| 35 | + $method = $reflectionClass->getMethod('buildHeaderString'); | |
| 36 | + $method->setAccessible(true); | |
| 36 | 37 | |
| 37 | - $headerString = $method->invoke($curl); | |
| 38 | - $test->assertStringContains('Accept: application/json', $headerString); | |
| 39 | - $test->assertStringContains('User-Agent: LoliTest/1.0', $headerString); | |
| 40 | - }); | |
| 38 | + $headerString = $method->invoke($curl); | |
| 39 | + $test->assertStringContains('Accept: application/json', $headerString); | |
| 40 | + $test->assertStringContains('User-Agent: LoliTest/1.0', $headerString); | |
| 41 | + }); | |
| 41 | 42 | |
| 42 | - $test->skip('移転を対応するはず', '作成中・・・'); | |
| 43 | + $test->skip('移転を対応するはず', '作成中・・・'); | |
| 43 | 44 | |
| 44 | - $test->it('メソッドチェーニングを対応するはず', function($test): void { | |
| 45 | - $curl = new Curl(); | |
| 46 | - $result = $curl->setUrl('https://076.moe') | |
| 47 | - ->setMethod('GET') | |
| 48 | - ->setTimeout(30); | |
| 45 | + $test->it('メソッドチェーニングを対応するはず', function($test): void { | |
| 46 | + $curl = new Curl(); | |
| 47 | + $result = $curl->setUrl('https://076.moe') | |
| 48 | + ->setMethod('GET') | |
| 49 | + ->setTimeout(30); | |
| 49 | 50 | |
| 50 | - $test->assertSame($curl, $result); | |
| 51 | + $test->assertSame($curl, $result); | |
| 52 | + }); | |
| 51 | 53 | }); |
| 52 | -}); | |
| 53 | 54 | |
| 54 | -$test->describe('Curl HTTP リクエスト', function($test): void { | |
| 55 | - $networkAvailable = true; | |
| 55 | + $test->describe('Curl HTTP リクエスト', function($test): void { | |
| 56 | + $networkAvailable = true; | |
| 56 | 57 | |
| 57 | - if (!$networkAvailable) { | |
| 58 | - $test->skip('076.moeでGETリクエストの確認', 'ネットワークが無効です。'); | |
| 59 | - $test->skip('postman-echo.comでPOSTリクエストの確認', 'ネットワークが無効です。'); | |
| 60 | - return; | |
| 61 | - } | |
| 58 | + if (!$networkAvailable) { | |
| 59 | + $test->skip('076.moeでGETリクエストの確認', 'ネットワークが無効です。'); | |
| 60 | + $test->skip('postman-echo.comでPOSTリクエストの確認', 'ネットワークが無効です。'); | |
| 61 | + return; | |
| 62 | + } | |
| 62 | 63 | |
| 63 | - $test->it('076.moeでGETリクエストの確認', function($test): void { | |
| 64 | - $curl = new Curl('https://076.moe'); | |
| 65 | - $result = $curl->execute(); | |
| 64 | + $test->it('076.moeでGETリクエストの確認', function($test): void { | |
| 65 | + $curl = new Curl('https://076.moe'); | |
| 66 | + $result = $curl->execute(); | |
| 66 | 67 | |
| 67 | - $test->assertTrue($result); | |
| 68 | - $test->assertEquals(200, $curl->getResponseCode()); | |
| 69 | - $test->assertNotNull($curl->getResponseBody()); | |
| 70 | - $test->assertStringContains('<html', $curl->getResponseBody()); | |
| 71 | - }); | |
| 68 | + $test->assertTrue($result); | |
| 69 | + $test->assertEquals(200, $curl->getResponseCode()); | |
| 70 | + $test->assertNotNull($curl->getResponseBody()); | |
| 71 | + $test->assertStringContains('<html', $curl->getResponseBody()); | |
| 72 | + }); | |
| 72 | 73 | |
| 73 | - $test->it('postman-echo.comでPOSTリクエストの確認', function($test): void { | |
| 74 | - $curl = new Curl(); | |
| 75 | - $curl->setUrl('https://postman-echo.com/post') | |
| 76 | - ->setMethod('POST') | |
| 77 | - ->setPostFields([ | |
| 78 | - 'name' => '山田太郎', | |
| 79 | - 'email' => 't.yamada@example.com' | |
| 80 | - ]); | |
| 74 | + $test->it('postman-echo.comでPOSTリクエストの確認', function($test): void { | |
| 75 | + $curl = new Curl(); | |
| 76 | + $curl->setUrl('https://postman-echo.com/post') | |
| 77 | + ->setMethod('POST') | |
| 78 | + ->setPostFields([ | |
| 79 | + 'name' => '山田太郎', | |
| 80 | + 'email' => 't.yamada@example.com' | |
| 81 | + ]); | |
| 81 | 82 | |
| 82 | - $result = $curl->execute(); | |
| 83 | - $test->assertTrue($result); | |
| 84 | - $test->assertEquals(200, $curl->getResponseCode()); | |
| 83 | + $result = $curl->execute(); | |
| 84 | + $test->assertTrue($result); | |
| 85 | + $test->assertEquals(200, $curl->getResponseCode()); | |
| 85 | 86 | |
| 86 | - $responseBody = $curl->getResponseBody(); | |
| 87 | - $test->assertStringContains('山田太郎', $responseBody); | |
| 88 | - $test->assertStringContains('t.yamada@example.com', $responseBody); | |
| 87 | + $responseBody = $curl->getResponseBody(); | |
| 88 | + $test->assertStringContains('山田太郎', $responseBody); | |
| 89 | + $test->assertStringContains('t.yamada@example.com', $responseBody); | |
| 90 | + }); | |
| 89 | 91 | }); |
| 90 | -}); | |
| 91 | 92 | |
| 92 | -$test->printSummary(); | |
| 93 | + $test->printSummary(); | |
| 94 | +} |
| @@ -6,61 +6,63 @@ | ||
| 6 | 6 | use Site\Lib\Tester; |
| 7 | 7 | use Site\Lib\Mysql; |
| 8 | 8 | |
| 9 | -$test = new Tester([ | |
| 10 | - 'colorOutput' => true, | |
| 11 | - 'verboseOutput' => true | |
| 12 | -]); | |
| 9 | +if (MYSQL_ENABLED) { | |
| 10 | + $test = new Tester([ | |
| 11 | + 'colorOutput' => true, | |
| 12 | + 'verboseOutput' => true | |
| 13 | + ]); | |
| 13 | 14 | |
| 14 | -$test->describe('パケットのデバッグ', function($test): void { | |
| 15 | - try { | |
| 16 | - $db = new Mysql(); | |
| 15 | + $test->describe('パケットのデバッグ', function($test): void { | |
| 16 | + try { | |
| 17 | + $db = new Mysql(); | |
| 17 | 18 | |
| 18 | - $db->setDebug(true); | |
| 19 | - $db->connect(); | |
| 19 | + $db->setDebug(true); | |
| 20 | + $db->connect(); | |
| 20 | 21 | |
| 21 | - $result = $db->query('SELECT * FROM user WHERE id = 1'); | |
| 22 | + $result = $db->query('SELECT * FROM user WHERE id = 1'); | |
| 22 | 23 | |
| 23 | - foreach ($result['rows'] as $row) { | |
| 24 | - echo "ユーザー名: ".$row['nickname']."\n"; | |
| 24 | + foreach ($result['rows'] as $row) { | |
| 25 | + echo "ユーザー名: ".$row['nickname']."\n"; | |
| 26 | + } | |
| 27 | + | |
| 28 | + $db->savePacketLogToFile('mysql_log.txt'); | |
| 29 | + $db->close(); | |
| 30 | + } catch (\Exception $e) { | |
| 31 | + echo 'エラー: '.$e->getMessage()."\n"; | |
| 25 | 32 | } |
| 33 | + }); | |
| 26 | 34 | |
| 27 | - $db->savePacketLogToFile('mysql_log.txt'); | |
| 28 | - $db->close(); | |
| 29 | - } catch (\Exception $e) { | |
| 30 | - echo 'エラー: '.$e->getMessage()."\n"; | |
| 31 | - } | |
| 32 | -}); | |
| 35 | + $test->describe('プリペアドステートメント', function($test): void { | |
| 36 | + try { | |
| 37 | + $db = new Mysql(); | |
| 38 | + $db->connect(); | |
| 33 | 39 | |
| 34 | -$test->describe('プリペアドステートメント', function($test): void { | |
| 35 | - try { | |
| 36 | - $db = new Mysql(); | |
| 37 | - $db->connect(); | |
| 40 | + // データの入り | |
| 41 | + $stmt = $db->prepare('INSERT INTO users (name, age) VALUES (?, ?)'); | |
| 42 | + $test->assertTrue($stmt); | |
| 38 | 43 | |
| 39 | - // データの入り | |
| 40 | - $stmt = $db->prepare('INSERT INTO users (name, age) VALUES (?, ?)'); | |
| 41 | - $test->assertTrue($stmt); | |
| 44 | + $db->execute($stmt, ['山田太郎', 25]); | |
| 45 | + // TODO: assert | |
| 42 | 46 | |
| 43 | - $db->execute($stmt, ['山田太郎', 25]); | |
| 44 | - // TODO: assert | |
| 47 | + $close = $db->demolish($stmt); | |
| 48 | + $this->assertTrue($close); | |
| 45 | 49 | |
| 46 | - $close = $db->demolish($stmt); | |
| 47 | - $this->assertTrue($close); | |
| 50 | + // データの受け取り | |
| 51 | + $stmt = $db->prepare('SELECT * FROM users WHERE age > ?'); | |
| 52 | + $test->assertTrue($stmt); | |
| 48 | 53 | |
| 49 | - // データの受け取り | |
| 50 | - $stmt = $db->prepare('SELECT * FROM users WHERE age > ?'); | |
| 51 | - $test->assertTrue($stmt); | |
| 54 | + $res = $db->execute($stmt, [20]); | |
| 55 | + // TODO: assert | |
| 56 | + print_r($res); | |
| 52 | 57 | |
| 53 | - $res = $db->execute($stmt, [20]); | |
| 54 | - // TODO: assert | |
| 55 | - print_r($res); | |
| 58 | + $close = $db->demolish($stmt); | |
| 59 | + $this->assertTrue($close); | |
| 56 | 60 | |
| 57 | - $close = $db->demolish($stmt); | |
| 58 | - $this->assertTrue($close); | |
| 61 | + $db->close(); | |
| 62 | + } catch (\Exception $e) { | |
| 63 | + echo 'エラー: '.$e->getMessage()."\n"; | |
| 64 | + } | |
| 65 | + }); | |
| 59 | 66 | |
| 60 | - $db->close(); | |
| 61 | - } catch (\Exception $e) { | |
| 62 | - echo 'エラー: '.$e->getMessage()."\n"; | |
| 63 | - } | |
| 64 | -}); | |
| 65 | - | |
| 66 | -$test->printSummary(); | |
| 67 | + $test->printSummary(); | |
| 68 | +} |
変更
tester.php
| @@ -1,13 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | require_once __DIR__.DIRECTORY_SEPARATOR.'/autoload.php'; |
| 3 | -require_once __DIR__.DIRECTORY_SEPARATOR.'/util.php'; | |
| 4 | 3 | define('ROOT', realpath(__DIR__)); |
| 5 | -require_once __DIR__.DIRECTORY_SEPARATOR.'/config/config.php'; | |
| 4 | +require_once ROOT.'/util.php'; | |
| 5 | +require_once ROOT.'/config/config.php'; | |
| 6 | 6 | |
| 7 | 7 | mb_internal_encoding('UTF-8'); |
| 8 | 8 | header('Content-Type: text/plain; charset=UTF-8'); |
| 9 | 9 | |
| 10 | -$testDir = __DIR__.DIRECTORY_SEPARATOR.'src/Site/Test'; | |
| 10 | +$testDir = ROOT.'/src/Site/Test'; | |
| 11 | 11 | $testFiles = glob($testDir.'/*.php'); |
| 12 | 12 | |
| 13 | 13 | if (empty($testFiles)) { |