Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d14340d
Update tests for phpBB4
iMattPro May 10, 2026
61e1c24
Merge branch 'main' into develop
iMattPro May 11, 2026
3d14e70
Merge commit '5b072fa4f5ed1020d4b7df1a8d3cf171dfdcdbfc' into develop
github-actions[bot] May 12, 2026
156020c
Merge commit 'f142baae1c00659214e1c43ae56ec857636f65b3' into develop
github-actions[bot] May 12, 2026
5760c27
Merge commit '4fcefa99502dc400d90be6130f8bc0b3bd1fc333' into develop
github-actions[bot] May 12, 2026
121e047
Fix tests
iMattPro May 12, 2026
94e2f22
Merge commit '4c45e8d3417900bd066551d24ad8ded15f125718' into develop
github-actions[bot] May 13, 2026
2addf3e
Fix test deprecations
iMattPro May 14, 2026
2ead256
Remove unused service
iMattPro May 14, 2026
3f69adc
Add temporary new template event file for consent settings link
iMattPro May 14, 2026
3aef235
Merge commit '7b38152b7cbbcb68c94d650b22f85788cd59e269' into develop
github-actions[bot] May 15, 2026
0c67acb
Merge commit '0dbb1dbc217d17a9301a6c379e3331a00d2f297f' into develop
github-actions[bot] May 16, 2026
05eb744
Merge commit 'a1648b0f8cdfd7e9465a511d83a9911ddf93a405' into develop
github-actions[bot] May 17, 2026
19e0dec
Merge branch 'main' into develop
iMattPro May 18, 2026
08367c0
Merge commit '80369c6ac36f04a0b1fa61c09e91395f86cc1f10' into develop
github-actions[bot] May 18, 2026
73a1b14
Merge branch 'main' into develop
iMattPro May 18, 2026
42d3769
Fix merge regressions
iMattPro May 18, 2026
d5b856b
Merge commit 'be73a8fb937ac1ac1dbb7ff8219a159df70d67dd' into develop
github-actions[bot] May 26, 2026
d4a0898
Merge commit 'd2be2c697b284650fa6a2de0a0c19fb1bb204dbc' into develop
github-actions[bot] May 27, 2026
fdf3a77
Merge commit '465a0a95b665f95e570dc873281a6956a00fdd98' into develop
github-actions[bot] May 27, 2026
0d3d487
Merge commit 'b7b893bd46ab4b8bf721ff4c28777862b5a1902f' into develop
github-actions[bot] May 29, 2026
4daf3f5
Merge branch 'main' into develop
iMattPro Jun 1, 2026
01a8087
Fix tests
iMattPro Jun 1, 2026
58ec731
Merge commit '77a8c9c75793401553f516654071a8562e0373cb' into develop
github-actions[bot] Jun 4, 2026
4d481ca
Merge commit 'ba695c3457dabd7baac062f9afc4c161021abcdf' into develop
github-actions[bot] Jun 7, 2026
3dddba3
Merge commit '9225678799069e2ccf4ba9657f3f91966151fdc8' into develop
github-actions[bot] Jun 9, 2026
9cba1b0
Merge commit '33a8221bf07ff0b192c837b556b0b1be6a534a7b' into develop
github-actions[bot] Jun 9, 2026
cf80a0c
Merge commit 'aeb4fba19c63a80d2d0431727f1dddefa5af3baf' into develop
github-actions[bot] Jun 16, 2026
59a951c
Merge commit '07cf8f640371047bb00c3de64daccf85cf27d9a4' into develop
github-actions[bot] Jun 16, 2026
48f3491
Merge commit '74410647e6dd2812dc440c9867eec5c5ab0ad600' into develop
github-actions[bot] Aug 12, 2026
f70c82d
Merge commit '9f7f76d58bf7df396203e7b178ea80163fadddaf' into develop
github-actions[bot] Aug 14, 2026
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 .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

call-tests:
name: Extension tests
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@3.3.x
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@master
with:
EXTNAME: phpbb/consentmanager
CODECOV: 1
Expand Down
1 change: 0 additions & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ services:
- '@dispatcher'
- '@template.twig.environment'
- '@path_helper'
- '@filesystem'
- '@request'

phpbb.consentmanager.log_manager:
Expand Down
34 changes: 16 additions & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="true"
backupStaticAttributes="true"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
cacheResult="false"
bootstrap="../../../../tests/bootstrap.php"
>
backupStaticProperties="false">
<testsuites>
<testsuite name="Extension Test Suite">
<directory suffix="_test.php">./tests</directory>
Expand All @@ -20,15 +17,16 @@
<directory suffix="_test.php">./tests/functional/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<source restrictDeprecations="true"
restrictNotices="true"
restrictWarnings="true">
<include>
<directory suffix=".php">./</directory>
<exclude>
<directory suffix=".php">./language/</directory>
<directory suffix=".php">./migrations/</directory>
<directory suffix=".php">./tests/</directory>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<directory suffix=".php">./language/</directory>
<directory suffix=".php">./migrations/</directory>
<directory suffix=".php">./tests/</directory>
</exclude>
</source>
</phpunit>
10 changes: 2 additions & 8 deletions service/consent_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use phpbb\config\config;
use phpbb\config\db_text;
use phpbb\event\dispatcher_interface;
use phpbb\filesystem\filesystem;
use phpbb\language\language;
use phpbb\path_helper;
use phpbb\request\request_interface;
Expand Down Expand Up @@ -50,9 +49,6 @@ class consent_manager implements consent_manager_interface
/** @var path_helper */
protected $path_helper;

/** @var filesystem */
protected $filesystem;

/** @var request_interface */
protected $request;

Expand Down Expand Up @@ -91,10 +87,9 @@ class consent_manager implements consent_manager_interface
* @param dispatcher_interface $dispatcher Event dispatcher
* @param environment $twig_environment Twig environment
* @param path_helper $path_helper Path helper
* @param filesystem $filesystem Filesystem helper
* @param request_interface $request Request service
*/
public function __construct(consent_cache $consent_cache, translation_manager $translation_manager, config $config, db_text $config_text, language $language, dispatcher_interface $dispatcher, environment $twig_environment, path_helper $path_helper, filesystem $filesystem, request_interface $request)
public function __construct(consent_cache $consent_cache, translation_manager $translation_manager, config $config, db_text $config_text, language $language, dispatcher_interface $dispatcher, environment $twig_environment, path_helper $path_helper, request_interface $request)
{
$this->consent_cache = $consent_cache;
$this->translation_manager = $translation_manager;
Expand All @@ -104,7 +99,6 @@ public function __construct(consent_cache $consent_cache, translation_manager $t
$this->dispatcher = $dispatcher;
$this->twig_environment = $twig_environment;
$this->path_helper = $path_helper;
$this->filesystem = $filesystem;
$this->request = $request;
}

Expand Down Expand Up @@ -1014,7 +1008,7 @@ protected function resolve_local_asset_source($asset_path)
return $this->local_asset_sources[$asset_path];
}

$template_asset = new asset($asset_path, $this->path_helper, $this->filesystem);
$template_asset = new asset($asset_path, $this->path_helper);
if (!$this->is_valid_local_asset_path($asset_path) || !$template_asset->is_relative())
{
return $this->local_asset_sources[$asset_path] = '';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if S_CONSENTMANAGER_ENABLED %}
<li class="rightside in-menu" id="consent-manager-link-item" hidden="hidden">
<a href="#" id="consent-manager-link" role="menuitem" aria-controls="consent-manager-modal">
{{ Icon('font', 'sliders', lang('CONSENTMANAGER_SETTINGS_TITLE'), false) }}
</a>
</li>
{% endif %}
5 changes: 2 additions & 3 deletions tests/acp/acp_module_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function test_module_info()
], $this->module_manager->get_module_infos('acp', 'consentmanager_module'));
}

public function module_auth_test_data()
public static function module_auth_test_data()
{
return [
// module_auth, expected result
Expand Down Expand Up @@ -150,11 +150,10 @@ public function test_main_module_banner_mode()

protected function expect_controller_method($method)
{
$args = ['phpbb.consentmanager.controller.acp'];
$this->container
->expects(self::once())
->method('get')
->with(...$args)
->with('phpbb.consentmanager.controller.acp')
->willReturn($this->acp_controller);

$this->acp_controller
Expand Down
14 changes: 7 additions & 7 deletions tests/controller/acp_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function test_handle_consent_text_uses_sanitized_multibyte_request_variab

$request = $this->getMockBuilder('\phpbb\request\request')
->disableOriginalConstructor()
->setMethods(['is_set_post', 'variable', 'raw_variable'])
->onlyMethods(['is_set_post', 'variable', 'raw_variable'])
->getMock();
$request->method('is_set_post')
->willReturnCallback(static function ($name) {
Expand Down Expand Up @@ -341,7 +341,7 @@ public function test_handle_invalid_form_key($action, $manager_method, $log_acti
$this->create_controller($this->create_request_mock([$action => 1]))->handle();
}

public function handle_invalid_form_key_data()
public static function handle_invalid_form_key_data()
{
return [
'submit' => ['submit', 'save_settings'],
Expand Down Expand Up @@ -386,7 +386,7 @@ public function test_handle_logs_invalid_form_key_before_processing(array $reque
$this->create_controller($this->create_request_mock($request_values), self::EXPORT_URL)->handle_logs();
}

public function handle_logs_invalid_form_key_data()
public static function handle_logs_invalid_form_key_data()
{
return [
'download csv' => [
Expand Down Expand Up @@ -464,7 +464,7 @@ public function test_handle_logs_delete_requests_confirmation_with_current_filte
], $expected_token_fields), self::$confirm_hidden_fields);
}

public function handle_logs_delete_confirmation_data()
public static function handle_logs_delete_confirmation_data()
{
return [
'with current csrf tokens' => [
Expand Down Expand Up @@ -561,7 +561,7 @@ public function test_handle_logs_invalid_filters_show_error($action, array $requ
$this->create_controller($this->create_request_mock($request_values), self::EXPORT_URL)->handle_logs();
}

public function handle_logs_invalid_filter_data()
public static function handle_logs_invalid_filter_data()
{
$cases = [
'invalid date from' => [
Expand Down Expand Up @@ -755,7 +755,7 @@ public function test_handle_logs_unknown_username_shows_error($action)
]), self::EXPORT_URL)->handle_logs();
}

public function handle_logs_unknown_username_data()
public static function handle_logs_unknown_username_data()
{
return [
'download csv' => ['download_csv'],
Expand All @@ -767,7 +767,7 @@ protected function create_request_mock(array $values = [], array $raw_values = [
{
$request = $this->getMockBuilder('\phpbb\request\request')
->disableOriginalConstructor()
->setMethods(['is_set_post', 'variable', 'raw_variable'])
->onlyMethods(['is_set_post', 'variable', 'raw_variable'])
->getMock();

$request->method('is_set_post')
Expand Down
2 changes: 1 addition & 1 deletion tests/controller/log_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function test_log_persists_valid_submission()
), json_decode($response->getContent(), true));
}

public function invalid_submission_data()
public static function invalid_submission_data()
{
return array(
'invalid hash' => array('invalid_hash', 403),
Expand Down
47 changes: 29 additions & 18 deletions tests/event/listener_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function test_configure_iframe_renderer_delegates_to_media_manager()
]));
}

public function inject_frontend_assigns_template_payload_data()
public static function inject_frontend_assigns_template_payload_data()
{
return [
'front end' => [true],
Expand Down Expand Up @@ -145,24 +145,35 @@ public function test_inject_frontend_assigns_template_payload($invoke)
]);
$template->expects($invoke ? self::exactly(2) : self::never())
->method('assign_block_vars')
->withConsecutive(
['CONSENTMANAGER_CATEGORIES', [
'ID' => 'necessary',
'LABEL' => 'Necessary',
'DESCRIPTION' => 'Required cookies.',
'REQUIRED' => true,
'services' => [
[
'LABEL' => 'Cookie baker',
'DESCRIPTION' => 'Delicious cookies',
->willReturnCallback(function() use ($invoke) {
static $call = 0;
$args = func_get_args();
if ($call === 0)
{
self::assertSame('CONSENTMANAGER_CATEGORIES', $args[0]);
self::assertSame([
'ID' => 'necessary',
'LABEL' => 'Necessary',
'DESCRIPTION' => 'Required cookies.',
'REQUIRED' => true,
'services' => [
[
'LABEL' => 'Cookie baker',
'DESCRIPTION' => 'Delicious cookies',
],
],
],
]],
['CONSENTMANAGER_CATEGORIES.CONSENTMANAGER_SERVICES', [
'LABEL' => 'Cookie baker',
'DESCRIPTION' => 'Delicious cookies',
]]
);
], $args[1]);
}
else
{
self::assertSame('CONSENTMANAGER_CATEGORIES.CONSENTMANAGER_SERVICES', $args[0]);
self::assertSame([
'LABEL' => 'Cookie baker',
'DESCRIPTION' => 'Delicious cookies',
], $args[1]);
}
$call++;
});

$listener = new class($helper, $this->language, $consent_manager, $template, $this->media_manager, $invoke) extends \phpbb\consentmanager\event\listener {
/** @var bool */
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/frontend_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function test_log_endpoint_rejects_invalid_json_payload()
'{invalid'
);

$this->assertSame(400, self::$client->getResponse()->getStatus());
$this->assertSame(400, self::$client->getResponse()->getStatusCode());
$this->assertSame(array(
'success' => false,
'error' => 'invalid_payload',
Expand All @@ -93,7 +93,7 @@ public function test_log_endpoint_persists_valid_anonymous_submission()
$payload = $this->fetch_frontend_payload();
$response = $this->post_log_request($payload, array('analytics', 'analytics', 'unknown'));

$this->assertSame(200, self::$client->getResponse()->getStatus());
$this->assertSame(200, self::$client->getResponse()->getStatusCode());
$this->assertSame(array('necessary', 'analytics'), $response['categories']);
$this->assertSame($payload['version'], $response['version']);

Expand All @@ -114,7 +114,7 @@ public function test_log_endpoint_persists_valid_authenticated_submission()
$payload = $this->fetch_frontend_payload();
$response = $this->post_log_request($payload, array('analytics', 'analytics', 'unknown'));

$this->assertSame(200, self::$client->getResponse()->getStatus());
$this->assertSame(200, self::$client->getResponse()->getStatusCode());
$this->assertSame(array('necessary', 'analytics'), $response['categories']);
$this->assertSame($payload['version'], $response['version']);

Expand All @@ -134,7 +134,7 @@ public function test_log_endpoint_rejects_stale_version()
$payload = $this->fetch_frontend_payload();
$response = $this->post_log_request($payload, array('analytics'), $payload['version'] + 1);

$this->assertSame(409, self::$client->getResponse()->getStatus());
$this->assertSame(409, self::$client->getResponse()->getStatusCode());
$this->assertSame('version_mismatch', $response['error']);
}

Expand Down
17 changes: 7 additions & 10 deletions tests/service/acp_manager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function test_log_admin_action_delegates_to_phpbb_log($log_action)
{
$log = $this->getMockBuilder('\phpbb\log\log')
->disableOriginalConstructor()
->setMethods(array('add'))
->onlyMethods(array('add'))
->getMock();
$log->expects(self::once())
->method('add')
Expand All @@ -70,7 +70,7 @@ public function test_log_admin_action_delegates_to_phpbb_log($log_action)
$this->create_manager(7, 'admin-session', $log)->log_admin_action($log_action);
}

public function log_admin_action_data()
public static function log_admin_action_data()
{
return [
['LOG_CONSENTMANAGER_UPDATED'],
Expand Down Expand Up @@ -334,7 +334,7 @@ public function test_save_settings_rejects_invalid_integrations($json)
self::assertSame([$this->language->lang('ACP_CONSENTMANAGER_INVALID_INTEGRATIONS')], $errors);
}

public function invalid_integrations_data()
public static function invalid_integrations_data()
{
return [
'malformed json' => ['{not json'],
Expand Down Expand Up @@ -370,7 +370,7 @@ public function test_save_settings_rejects_invalid_array_integrations($integrati
self::assertSame($expected_errors, $errors);
}

public function invalid_array_integrations_data()
public static function invalid_array_integrations_data()
{
return [
'invalid entry' => [
Expand Down Expand Up @@ -511,10 +511,10 @@ public function test_stream_logs_csv_row_format_is_correct()
self::assertCount(4, $row);

// anonymized_id: 64-char hex
self::assertRegExp('/^[0-9a-f]{64}$/', $row[0]);
self::assertMatchesRegularExpression('/^[0-9a-f]{64}$/', $row[0]);

// timestamp: ISO 8601 UTC
self::assertRegExp('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/', $row[1]);
self::assertMatchesRegularExpression('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/', $row[1]);

// consent_version
self::assertSame('3', $row[2]);
Expand Down Expand Up @@ -794,10 +794,7 @@ protected function get_language_messages(array $message_specs)

protected function invoke_method($object, $method_name, array $arguments = [])
{
$method = new \ReflectionMethod($object, $method_name);
$method->setAccessible(true);

return $method->invokeArgs($object, $arguments);
return (new \ReflectionMethod($object, $method_name))->invokeArgs($object, $arguments);
}

protected function create_log_manager($user_id, $session_id)
Expand Down
Loading
Loading