Skip to content

Commit 7567eea

Browse files
committed
Update tests
1 parent 755d072 commit 7567eea

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

tests/controller/controller_webpush_test.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,26 @@ public function test_toggle_popup_not_ajax()
485485
$this->controller->toggle_popup();
486486
}
487487

488-
public function test_toggle_popup_anonymous_user()
488+
public function data_toggle_popup_anonymous_user()
489+
{
490+
return [
491+
[ANONYMOUS, USER_NORMAL, false],
492+
[2, USER_IGNORE, false],
493+
[2, USER_INACTIVE, false],
494+
[2, USER_NORMAL, true],
495+
];
496+
}
497+
498+
/**
499+
* @dataProvider data_toggle_popup_anonymous_user
500+
*/
501+
public function test_toggle_popup_anonymous_user($user_id, $user_type, $is_bot)
489502
{
490503
$this->form_helper->method('check_form_tokens')->willReturn(true);
491504
$this->request->method('is_ajax')->willReturn(true);
492-
$this->user->data['user_id'] = ANONYMOUS;
493-
$this->user->data['is_bot'] = false;
494-
$this->user->data['user_type'] = USER_NORMAL;
505+
$this->user->data['user_id'] = $user_id;
506+
$this->user->data['is_bot'] = $is_bot;
507+
$this->user->data['user_type'] = $user_type;
495508

496509
$this->expectException(http_exception::class);
497510
$this->expectExceptionMessage('NO_AUTH_OPERATION');

0 commit comments

Comments
 (0)