Skip to content

Commit ffafc60

Browse files
committed
Fix deprecations
1 parent 0660c8d commit ffafc60

7 files changed

Lines changed: 43 additions & 35 deletions

File tree

phpunit.xml.dist

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,12 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
backupGlobals="true"
5-
backupStaticAttributes="false"
65
colors="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
106
processIsolation="false"
117
stopOnFailure="false"
128
cacheResult="false"
139
bootstrap="../../../../tests/bootstrap.php"
14-
>
15-
<coverage>
16-
<include>
17-
<directory suffix=".php">./</directory>
18-
</include>
19-
<exclude>
20-
<directory suffix=".php">./language/</directory>
21-
<directory suffix=".php">./migrations/</directory>
22-
<directory suffix=".php">./tests/</directory>
23-
</exclude>
24-
</coverage>
10+
backupStaticProperties="false">
2511
<testsuites>
2612
<testsuite name="Extension Test Suite">
2713
<directory suffix="_test.php">./tests</directory>
@@ -31,4 +17,14 @@
3117
<directory suffix="_test.php">./tests/functional/</directory>
3218
</testsuite>
3319
</testsuites>
20+
<source>
21+
<include>
22+
<directory suffix=".php">./</directory>
23+
</include>
24+
<exclude>
25+
<directory suffix=".php">./language/</directory>
26+
<directory suffix=".php">./migrations/</directory>
27+
<directory suffix=".php">./tests/</directory>
28+
</exclude>
29+
</source>
3430
</phpunit>

tests/acp/acp_controller_test.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class acp_controller_test extends \phpbb_test_case
5555
/** @var user $user */
5656
protected $user;
5757

58+
/** @var string */
59+
protected $u_action;
60+
5861
protected function setUp(): void
5962
{
6063
parent::setUp();
@@ -151,12 +154,16 @@ public function test_display_manage()
151154
->willReturn($this->container
152155
->get('text_formatter.s9e.factory')
153156
->get_configurator());
157+
$this->config_text->expects(self::once())
158+
->method('get')
159+
->with('media_embed_sites')
160+
->willReturn('[]');
154161

155162
$controller = $this->get_controller();
156163
$controller->display_manage();
157164
}
158165

159-
public function save_setting_data()
166+
public static function save_setting_data()
160167
{
161168
return [
162169
[true, ['youtube:100%', '[{"site":"youtube","width":"100%"}]'], ['code' => E_USER_NOTICE, 'message' => 'CONFIG_UPDATED']],

tests/acp/acp_module_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function test_module_info()
9393
], $this->module_manager->get_module_infos('acp', 'acp_main_module'));
9494
}
9595

96-
public function module_auth_test_data()
96+
public static function module_auth_test_data()
9797
{
9898
return [
9999
// module_auth, expected result
@@ -110,7 +110,7 @@ public function test_module_auth($module_auth, $expected)
110110
self::assertEquals($expected, \p_master::module_auth($module_auth, 0));
111111
}
112112

113-
public function main_module_test_data()
113+
public static function main_module_test_data()
114114
{
115115
return [
116116
['display', 'manage', null], // test the display of manage sites module

tests/cron_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function test_run()
5757
*
5858
* @return array Array of test data
5959
*/
60-
public function should_run_data()
60+
public static function should_run_data()
6161
{
6262
return [
6363
[time(), false],
@@ -83,7 +83,7 @@ public function test_should_run($time, $expected)
8383
self::assertSame($expected, $this->cron_task->should_run());
8484
}
8585

86-
public function is_runnable_data()
86+
public static function is_runnable_data()
8787
{
8888
return [
8989
[true],

tests/event/listener_test.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function test_set_permissions()
160160
*
161161
* @return array
162162
*/
163-
public function configure_media_embed_data()
163+
public static function configure_media_embed_data()
164164
{
165165
return [
166166
['dailymotion', '[media]http://www.dailymotion.com/video/x222z1[/media]', 'DAILYMOTION id="x222z1"', false, true, true], // site using the MEDIA BBCode
@@ -238,7 +238,7 @@ public function test_configure_media_embed($tag, $code, $id, $exists, $parse_url
238238
*
239239
* @return array
240240
*/
241-
public function exception_errors_data()
241+
public static function exception_errors_data()
242242
{
243243
return [
244244
['notok', '\Symfony\Component\Yaml\Exception\ParseException'], // Exception when custom site YAML is invalid
@@ -283,7 +283,7 @@ public function test_exception_errors($site, $exception)
283283
$listener->enable_media_sites($event);
284284
}
285285

286-
public function check_methods_data()
286+
public static function check_methods_data()
287287
{
288288
return [
289289
['check_signature', ['mode' => 'sig'], ['media_embed_allow_sig' => false], 1, 1],
@@ -354,7 +354,7 @@ public function test_check_methods($method, $data, $configs, $disable_plugin, $d
354354
*
355355
* @return array
356356
*/
357-
public function check_permissions_data()
357+
public static function check_permissions_data()
358358
{
359359
return [
360360
[2, 'f_mediaembed', false],
@@ -439,6 +439,11 @@ public function test_setup_media_configs()
439439
'S_MEDIA_EMBED_MAX_WIDTHS' => '',
440440
]);
441441

442+
$this->config_text->expects(self::once())
443+
->method('get')
444+
->with('media_embed_max_width')
445+
->willReturn('');
446+
442447
$listener->setup_media_configs();
443448
}
444449

@@ -479,7 +484,7 @@ public function test_media_embed_help()
479484
*
480485
* @return array
481486
*/
482-
public function setup_cache_dir_data()
487+
public static function setup_cache_dir_data()
483488
{
484489
return [
485490
[true],

tests/ext_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function get_ext()
7070
);
7171
}
7272

73-
public function ext_test_data()
73+
public static function ext_test_data()
7474
{
7575
return [
7676
[false, true],

tests/functional/media_embed_test.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
*/
1818
class media_embed_test extends \phpbb_functional_test_case
1919
{
20-
protected $youtubeId = 'PHzShhtkzEk';
21-
protected $ok_ru_Id = '549000643961';
20+
const YOUTUBE_ID = 'PHzShhtkzEk';
21+
const OK_RU_ID = '549000643961';
2222

2323
protected static function setup_extensions()
2424
{
@@ -29,9 +29,9 @@ public function test_posting_media_bbcode()
2929
{
3030
$this->login();
3131

32-
$post = $this->create_topic(2, 'Media Embed Test Topic 1', "[media]https://youtu.be/$this->youtubeId[/media]");
32+
$post = $this->create_topic(2, 'Media Embed Test Topic 1', "[media]https://youtu.be/" . self::YOUTUBE_ID . "[/media]");
3333
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid=$this->sid");
34-
self::assertStringContainsString("//www.youtube.com/embed/$this->youtubeId", $crawler->filter("#post_content{$post['topic_id']} iframe")->attr('src'));
34+
self::assertStringContainsString("//www.youtube.com/embed/" . self::YOUTUBE_ID, $crawler->filter("#post_content{$post['topic_id']} iframe")->attr('src'));
3535
}
3636

3737
public function test_posting_custom_site()
@@ -55,16 +55,16 @@ public function test_posting_custom_site()
5555
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid=$this->sid");
5656
$this->assert_checkbox_is_checked($crawler, 'ok');
5757

58-
$post = $this->create_topic(2, 'Media Embed Custom Site Test Topic 1', "[media]https://ok.ru/video/$this->ok_ru_Id[/media]");
58+
$post = $this->create_topic(2, 'Media Embed Custom Site Test Topic 1', "[media]https://ok.ru/video/" . self::OK_RU_ID . "[/media]");
5959
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid=$this->sid");
60-
self::assertStringContainsString("//ok.ru/videoembed/$this->ok_ru_Id", $crawler->filter("#post_content{$post['topic_id']} iframe")->attr('src'));
60+
self::assertStringContainsString("//ok.ru/videoembed/" . self::OK_RU_ID, $crawler->filter("#post_content{$post['topic_id']} iframe")->attr('src'));
6161
}
6262

63-
public function signatures_data()
63+
public static function signatures_data()
6464
{
6565
return [
6666
[false, 'UNAUTHORISED_BBCODE'],
67-
[true, "//www.youtube.com/embed/$this->youtubeId"],
67+
[true, "//www.youtube.com/embed/" . self::YOUTUBE_ID],
6868
];
6969
}
7070

@@ -89,7 +89,7 @@ public function test_signatures($allowed, $expected)
8989
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=signature');
9090

9191
$form = $crawler->selectButton('Submit')->form([
92-
'signature' => "[media]https://youtu.be/$this->youtubeId[/media]",
92+
'signature' => "[media]https://youtu.be/" . self::YOUTUBE_ID . "[/media]",
9393
]);
9494

9595
$crawler = self::submit($form);

0 commit comments

Comments
 (0)