summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Burschka2016-04-04 18:29:25 +0000
committerChristoph Burschka2016-04-04 18:29:25 +0000
commit876ecc19572f98bd40c128d4e01e5a3a949c5153 (patch)
treed0e96c3ab74060529f8e20a0c5e069f9cd6299af
parentFix #11: Revert escape sequences in XMPP node names. (diff)
downloadejabberd-auth-php-876ecc19572f98bd40c128d4e01e5a3a949c5153.tar.gz
Test with domain argument.
If a bridge actually uses the domain part when authenticating, then the unit tests also needs to be able to pass one instead of hardcoding "localhost".
-rwxr-xr-xtests/test.php7
-rw-r--r--tests/unit_test.php18
2 files changed, 13 insertions, 12 deletions
diff --git a/tests/test.php b/tests/test.php
index 91b2dbb..c37fa82 100755
--- a/tests/test.php
+++ b/tests/test.php
@@ -1,16 +1,17 @@
#!/usr/bin/env php
<?php
-if ($_SERVER['argc'] != 3) {
+if ($_SERVER['argc'] != 4) {
die(
'Usage:
- test.php <valid-user> <valid-pass>
+ test.php <valid-user> <valid-domain> <valid-pass>
');
}
$valid_account = [
'user' => $_SERVER['argv'][1],
- 'password' => $_SERVER['argv'][2],
+ 'domain' => $_SERVER['argv'][2],
+ 'password' => $_SERVER['argv'][3],
];
require_once __DIR__ . '/unit_test.php';
diff --git a/tests/unit_test.php b/tests/unit_test.php
index 86fff61..0991260 100644
--- a/tests/unit_test.php
+++ b/tests/unit_test.php
@@ -48,38 +48,38 @@ class UnitTest {
}
function TestUserGood() {
- $this->assert(['isuser', $this->valid['user'], 'localhost'], TRUE, 'isuser with valid username');
+ $this->assert(['isuser', $this->valid['user'], $this->valid['domain']], TRUE, 'isuser with valid username');
}
function TestUserBad() {
- $this->assert(['isuser', '123456789', 'localhost'], FALSE, 'isuser with bad username');
+ $this->assert(['isuser', '123456789', $this->valid['domain']], FALSE, 'isuser with bad username');
}
function TestAuthGood() {
- $this->assert(['auth', $this->valid['user'], 'localhost', $this->valid['password']], TRUE, 'auth with valid password');
+ $this->assert(['auth', $this->valid['user'], $this->valid['domain'], $this->valid['password']], TRUE, 'auth with valid password');
}
function TestAuthBadUser() {
- $this->assert(['auth', '123456789', 'localhost', '123456789'], FALSE, 'auth with bad username');
+ $this->assert(['auth', '123456789', $this->valid['domain'], '123456789'], FALSE, 'auth with bad username');
}
function TestAuthBadPass() {
- $this->assert(['auth', $this->valid['user'], 'localhost', '123456789'], FALSE, 'auth with bad password');
+ $this->assert(['auth', $this->valid['user'], $this->valid['domain'], '123456789'], FALSE, 'auth with bad password');
}
function TestSetPass() {
- $this->assert(['setpass', '123456789', 'localhost', '123456789'], FALSE, 'attempt to set password (fail)');
+ $this->assert(['setpass', '123456789', $this->valid['domain'], '123456789'], FALSE, 'attempt to set password (fail)');
}
function TestRegister() {
- $this->assert(['tryregister', '123456789', 'localhost', '123456789'], FALSE, 'attempt to create account (fail)');
+ $this->assert(['tryregister', '123456789', $this->valid['domain'], '123456789'], FALSE, 'attempt to create account (fail)');
}
function TestRemove() {
- $this->assert(['removeuser', '123456789', 'localhost', '123456789'], FALSE, 'attempt to delete account (fail)');
+ $this->assert(['removeuser', '123456789', $this->valid['domain'], '123456789'], FALSE, 'attempt to delete account (fail)');
}
function TestRemove3() {
- $this->assert(['removeuser3', '123456789', 'localhost', '123456789'], FALSE, 'attempt to login and delete account (fail)');
+ $this->assert(['removeuser3', '123456789', $this->valid['domain'], '123456789'], FALSE, 'attempt to login and delete account (fail)');
}
}