From 876ecc19572f98bd40c128d4e01e5a3a949c5153 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Mon, 4 Apr 2016 18:29:25 +0000 Subject: 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". --- tests/test.php | 7 ++++--- tests/unit_test.php | 18 +++++++++--------- 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 + test.php '); } $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)'); } } -- cgit v1.1