summaryrefslogtreecommitdiff
path: root/tests/test.php
diff options
context:
space:
mode:
authorChristoph Burschka2012-10-30 02:45:21 +0100
committerChristoph Burschka2012-10-30 02:45:21 +0100
commit7fc3addf1b2796998fe0350cd4c5d7513612b1ba (patch)
treeda7b47008fc112e53aee5ab51b8a39f6be4f54f2 /tests/test.php
downloadejabberd-auth-php-7fc3addf1b2796998fe0350cd4c5d7513612b1ba.tar.gz
Initial checkin
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;
+}