summaryrefslogtreecommitdiffstats
path: root/application/test/tests
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-05-19 00:12:07 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-05-19 00:12:07 +0200
commitf3fa5579fc23f0a7dcc101e7bbfb68dda356b4dd (patch)
tree8eecef41cfedc7ba179df37a98778cf1b208011c /application/test/tests
parentb6c54853e96bd0616743a7e938b1b01712672be5 (diff)
Test result of delete_invitation_key
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/test/tests')
-rw-r--r--application/test/tests/test_service_user.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/application/test/tests/test_service_user.php b/application/test/tests/test_service_user.php
index 4cbbdfac0..d7e34a71b 100644
--- a/application/test/tests/test_service_user.php
+++ b/application/test/tests/test_service_user.php
@@ -34,24 +34,28 @@ class test_service_user extends \test\Test {
$result = $CI->db->select('user, key, action')->from('actions')->get()->result_array();
$this->t->is_deeply([['user' => "".$userid, 'key' => $key, 'action' => 'invitation']], $result, "database contains new key");
- \service\user::delete_invitation_key($userid+1, $key);
+ $ret = \service\user::delete_invitation_key($userid+1, $key);
+ $this->t->is(0, $ret, "Should have removed no keys because incorrect user/key");
$result = $CI->db->select('user, key, action')->from('actions')->get()->result_array();
$this->t->is_deeply([['user' => "".$userid, 'key' => $key, 'action' => 'invitation']], $result, "database contains new key after incorrect deletion");
- \service\user::delete_invitation_key($userid+1, "foobar-");
+ $ret = \service\user::delete_invitation_key($userid+1, "foobar-");
+ $this->t->is(0, $ret, "Should have removed no keys because incorrect user/key");
$result = $CI->db->select('user, key, action')->from('actions')->get()->result_array();
$this->t->is_deeply([['user' => "".$userid, 'key' => $key, 'action' => 'invitation']], $result, "database contains new key after incorrect deletion");
- \service\user::delete_invitation_key($userid+1, "");
+ $ret = \service\user::delete_invitation_key($userid+1, "");
+ $this->t->is(0, $ret, "Should have removed no keys because incorrect user/key");
$result = $CI->db->select('user, key, action')->from('actions')->get()->result_array();
$this->t->is_deeply([['user' => "".$userid, 'key' => $key, 'action' => 'invitation']], $result, "database contains new key after incorrect deletion");
- \service\user::delete_invitation_key($userid, "");
+ $ret = \service\user::delete_invitation_key($userid, "");
+ $this->t->is(0, $ret, "Should have removed no keys because incorrect user/key");
$result = $CI->db->select('user, key, action')->from('actions')->get()->result_array();
$this->t->is_deeply([['user' => "".$userid, 'key' => $key, 'action' => 'invitation']], $result, "database contains new key");
- \service\user::delete_invitation_key($userid, $key);
-
+ $ret = \service\user::delete_invitation_key($userid, $key);
+ $this->t->is(1, $ret, "One key should be removed");
$result = $CI->db->select('user, key, action')->from('actions')->get()->result_array();
$this->t->is_deeply([], $result, "key has been deleted");