Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/event/delete_log_security_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public function test_delete_logs_security($mode, $log_type, $expected_log_type)

$new_events = $event->get_data_filtered($event_data);

$this->assertSame($expected_log_type, $new_events['log_type']);
self::assertSame($expected_log_type, $new_events['log_type']);
}
}
4 changes: 2 additions & 2 deletions tests/event/email_change_notification_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ public function test_email_change_notification($listener, $enabled, $in_watch_gr

$this->set_listener();

$this->listener->expects($this->atMost(1))
$this->listener->expects(self::atMost(1))
->method('in_watch_group')
->willReturn($in_watch_group);

// Check send_message once if conditions are true,
// otherwise check that it is never called.
$this->listener->expects(($enabled && $this->user->data['user_email'] != $data['email'] && $in_watch_group) ? $this->once() : $this->never())
$this->listener->expects(($enabled && $this->user->data['user_email'] != $data['email'] && $in_watch_group) ? self::once() : self::never())
->method('send_message')
->with($expected);

Expand Down
4 changes: 2 additions & 2 deletions tests/event/event_listener_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class event_listener_test extends listener_base
public function test_construct()
{
$this->set_listener();
$this->assertInstanceOf('\Symfony\Component\EventDispatcher\EventSubscriberInterface', $this->listener);
self::assertInstanceOf('\Symfony\Component\EventDispatcher\EventSubscriberInterface', $this->listener);
}

/**
* Test the event listener is subscribing events
*/
public function test_getSubscribedEvents()
{
$this->assertEquals(array(
self::assertEquals(array(
'core.user_setup',
'core.acp_users_overview_before',
'core.ucp_display_module_before',
Expand Down
10 changes: 5 additions & 5 deletions tests/event/failed_logins_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function log_failed_login_attempts_data()
{
return array(
array(true, true, array('user_row' => array('user_id' => 2))),
array(false, true, array()),
array(true, false, array()),
array(false, false, array()),
array(false, true, array('user_row' => array('user_id' => 0))),
array(true, false, array('user_row' => array('user_id' => 0))),
array(false, false, array('user_row' => array('user_id' => 0))),
);
}

Expand All @@ -40,13 +40,13 @@ public function test_log_failed_login_attempts($enabled, $in_watch_group, $resul

$this->set_listener();

$this->listener->expects($this->atMost(1))
$this->listener->expects(self::atMost(1))
->method('in_watch_group')
->willReturn($in_watch_group);

// Check log->add is called once with expected data if enabled and in_watch_group are true,
// otherwise check that it is never called.
$this->log->expects(($enabled && $in_watch_group) ? $this->once() : $this->never())
$this->log->expects(($enabled && $in_watch_group) ? self::once() : self::never())
->method('add')
->with('user', $result['user_row']['user_id'], $this->user->ip, 'LOG_TEAM_AUTH_FAIL', time(), array('reportee_id' => $result['user_row']['user_id']));

Expand Down
5 changes: 4 additions & 1 deletion tests/event/listener_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class listener_base extends \phpbb_test_case
/**
* Setup test environment
*/
public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -50,6 +50,9 @@ public function setUp()
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$this->lang = new \phpbb\language\language($lang_loader);
$this->user = new \phpbb\user($this->lang, '\phpbb\datetime');
$this->user->data['user_id'] = 100;
$this->user->data['username'] = '';
$this->user->data['user_email'] = '';
$this->root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
$phpbb_dispatcher = new \phpbb_mock_event_dispatcher();
Expand Down
2 changes: 1 addition & 1 deletion tests/event/load_language_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function test_load_language_on_setup($lang_set_ext, $expected_contains)

foreach ($expected_contains as $expected)
{
$this->assertContains($expected, $lang_set_ext);
self::assertContains($expected, $lang_set_ext);
}
}
}
2 changes: 1 addition & 1 deletion tests/event/login_notification_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function test_acp_login_notification($enabled, $admin, $username, $ip, $e

// Check send_message once if enabled and admin are true,
// otherwise check that it is never called.
$this->listener->expects(($enabled && $admin) ? $this->once() : $this->never())
$this->listener->expects(($enabled && $admin) ? self::once() : self::never())
->method('send_message')
->with($expected);

Expand Down
6 changes: 3 additions & 3 deletions tests/event/team_passwords_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function test_set_team_password_configs($listener, $mode, $user_row, $sec

$this->set_listener();

$this->listener->expects($this->atMost(1))
$this->listener->expects(self::atMost(1))
->method('in_watch_group')
->willReturn($in_watch_group);

Expand All @@ -62,7 +62,7 @@ public function test_set_team_password_configs($listener, $mode, $user_row, $sec
$event = new \phpbb\event\data(compact($event_data));
$dispatcher->dispatch($listener, $event);

$this->assertEquals($expected, $this->config['pass_complex']);
$this->assertEquals($sec_min_pass_chars, $this->config['min_pass_chars']);
self::assertEquals($expected, $this->config['pass_complex']);
self::assertEquals($sec_min_pass_chars, $this->config['min_pass_chars']);
}
}