summaryrefslogtreecommitdiff
path: root/tests/test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.php')
-rw-r--r--tests/test.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test.php b/tests/test.php
new file mode 100644
index 0000000..a6d6c16
--- /dev/null
+++ b/tests/test.php
@@ -0,0 +1,26 @@
+<?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),
+ array('isuser', '123456789'),
+ 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;
+}