diff options
Diffstat (limited to 'tests/test.php')
-rwxr-xr-x[-rw-r--r--] | tests/test.php | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/tests/test.php b/tests/test.php index ec6d35b..91b2dbb 100644..100755 --- a/tests/test.php +++ b/tests/test.php @@ -1,26 +1,18 @@ +#!/usr/bin/env php <?php -$stderr = fopen('php://stderr', 'w'); -$in = fopen('php://stdin', 'r'); -fwrite($stderr, "Enter a valid username: "); -$user = trim(fgets($in)); -fwrite($stderr, "Enter the password: "); -$password = trim(fgets($in)); -$str = array( - array('isuser', $user, 'localhost'), - array('isuser', '123456789', 'localhost'), - array('auth', $user, 'localhost', $password), - array('auth', $user, 'localhost', '123456789'), - - // These should all fail cleanly. - array('setpass', '123456789', 'localhost', '123456789'), - array('tryregister', '123456789', 'localhost', '123456789'), - array('removeuser', '123456789', 'localhost', '123456789'), - array('removeuser3', '123456789', 'localhost', '123456789'), -); - -foreach ($str as $command) { - $command = implode(':', $command); - print pack('n', strlen($command)); - print $command; +if ($_SERVER['argc'] != 3) { + die( +'Usage: + test.php <valid-user> <valid-pass> +'); } + +$valid_account = [ + 'user' => $_SERVER['argv'][1], + 'password' => $_SERVER['argv'][2], +]; + +require_once __DIR__ . '/unit_test.php'; + +(new UnitTest($valid_account))->run(); |