diff options
Diffstat (limited to 'tests/log/add_test.php')
-rw-r--r-- | tests/log/add_test.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/tests/log/add_test.php b/tests/log/add_test.php index a2b763f2b7..faf5953836 100644 --- a/tests/log/add_test.php +++ b/tests/log/add_test.php @@ -19,13 +19,21 @@ class phpbb_log_add_test extends phpbb_database_test_case public function test_log_enabled() { $log = new phpbb_log(LOG_TABLE); - $this->assertTrue($log->is_enabled()); + $this->assertTrue($log->is_enabled(), 'Initialise failed'); $log->disable(); - $this->assertFalse($log->is_enabled()); + $this->assertFalse($log->is_enabled(), 'Disable all failed'); $log->enable(); - $this->assertTrue($log->is_enabled()); + $this->assertTrue($log->is_enabled(), 'Enable all failed'); + + $log->disable('admin'); + $this->assertFalse($log->is_enabled('admin'), 'Disable admin failed'); + $this->assertTrue($log->is_enabled('user'), 'User should be enabled, is disabled'); + $this->assertTrue($log->is_enabled(), 'Disable admin disabled all'); + + $log->enable('admin'); + $this->assertTrue($log->is_enabled('admin'), 'Enable admin failed'); } public function test_log_add() @@ -45,9 +53,19 @@ class phpbb_log_add_test extends phpbb_database_test_case $log = new phpbb_log(LOG_TABLE); $this->assertEquals(1, $log->add($mode, $user_id, $log_ip, $log_operation, $log_time)); - // Disable logging + // Disable logging for all types $log->disable(); - $this->assertFalse($log->add($mode, $user_id, $log_ip, $log_operation, $log_time)); + $this->assertFalse($log->add($mode, $user_id, $log_ip, $log_operation, $log_time), 'Disable for all types failed'); + $log->enable(); + + // Disable logging for same type + $log->disable('critical'); + $this->assertFalse($log->add($mode, $user_id, $log_ip, $log_operation, $log_time), 'Disable for same type failed'); + $log->enable(); + + // Disable logging for different type + $log->disable('admin'); + $this->assertEquals(2, $log->add($mode, $user_id, $log_ip, $log_operation, $log_time), 'Disable for different types failed'); $log->enable(); // Invalid mode specified |