Skip to content

Commit 63b79bb

Browse files
committed
Minor test fixes
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 4a202b1 commit 63b79bb

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

tests/event/listener_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ public function test_configure_media_embed($tag, $code, $id, $exists, $parse_url
240240
*/
241241
public function exception_errors_data()
242242
{
243-
return array(
244-
array('notok', '\Symfony\Component\Yaml\Exception\ParseException'), // Exception when custom site YAML is invalid
245-
array('invalid', '\InvalidArgumentException'), // Exception when MediaEmbed can't process the site definition
246-
);
243+
return [
244+
['notok', '\Symfony\Component\Yaml\Exception\ParseException'], // Exception when custom site YAML is invalid
245+
['invalid', '\InvalidArgumentException'], // Exception when MediaEmbed can't process the site definition
246+
];
247247
}
248248

249249
/**

tests/functional/media_embed_test.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,42 @@ public function test_posting_media_bbcode()
2727
{
2828
$this->login();
2929

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

3535
public function test_posting_custom_site()
3636
{
3737
$this->login();
3838
$this->admin_login();
3939

40-
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid={$this->sid}");
40+
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid=$this->sid");
4141
$this->assert_checkbox_is_unchecked($crawler, 'ok');
4242
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
4343
$fields = $form->all();
4444
// Tick all the check boxes dang it, because unticked boxes can't be crawled alone
4545
foreach ($fields as $fieldname => $fieldobject)
4646
{
47-
if (preg_match('/mark\[(\d+)\]/', $fieldname, $matches))
47+
if (preg_match('/mark\[(\d+)]/', $fieldname, $matches))
4848
{
4949
$form['mark'][$matches[1]]->tick();
5050
}
5151
}
5252
self::submit($form);
53-
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid={$this->sid}");
53+
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid=$this->sid");
5454
$this->assert_checkbox_is_checked($crawler, 'ok');
5555

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

6161
public function signatures_data()
6262
{
6363
return [
6464
[false, 'UNAUTHORISED_BBCODE'],
65-
[true, "//www.youtube.com/embed/{$this->youtubeId}"],
65+
[true, "//www.youtube.com/embed/$this->youtubeId"],
6666
];
6767
}
6868

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

8989
$form = $crawler->selectButton('Submit')->form([
90-
'signature' => "[media]https://youtu.be/{$this->youtubeId}[/media]",
90+
'signature' => "[media]https://youtu.be/$this->youtubeId[/media]",
9191
]);
9292

9393
$crawler = self::submit($form);
@@ -112,9 +112,9 @@ public function test_posting_media_bbcode_wo_permission()
112112
$this->admin_login();
113113

114114
// Set f_mediaembed to never
115-
$crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=setting_forum_local&forum_id[0]=2&group_id[0]=2&sid={$this->sid}");
115+
$crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=setting_forum_local&forum_id[0]=2&group_id[0]=2&sid=$this->sid");
116116
$form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form();
117-
$data = array('setting[2][2][f_mediaembed]' => ACL_NEVER);
117+
$data = ['setting[2][2][f_mediaembed]' => ACL_NEVER];
118118
$form->setValues($data);
119119
self::submit($form);
120120

@@ -130,7 +130,7 @@ public function test_media_embed_help()
130130
$this->assertContainsLang('HELP_EMBEDDING_MEDIA', $crawler->filter('#faqlinks')->text());
131131

132132
preg_match('/https:\/\/youtu\.be\/(.*)/', $this->lang('HELP_EMBEDDING_MEDIA_DEMO'), $matches);
133-
self::assertStringContainsString("//www.youtube.com/embed/{$matches[1]}", $crawler->filter('body iframe')->attr('src'));
133+
self::assertStringContainsString("//www.youtube.com/embed/$matches[1]", $crawler->filter('body iframe')->attr('src'));
134134
}
135135

136136
public function test_acp_modules()
@@ -141,7 +141,7 @@ public function test_acp_modules()
141141
$this->admin_login();
142142

143143
// Test settings module width error
144-
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=settings&sid={$this->sid}");
144+
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=settings&sid=$this->sid");
145145
$this->assertContainsLang('ACP_MEDIA_SETTINGS', $crawler->filter('#main')->text(), 'The Media Embed settings module failed to load');
146146
$form_data = [
147147
'media_embed_max_width' => "vimo:100px\nyoutube:100",
@@ -153,7 +153,7 @@ public function test_acp_modules()
153153
self::assertStringContainsString($this->lang('ACP_MEDIA_INVALID_SITE', 'vimo', '100px') . '<br>' . $this->lang('ACP_MEDIA_INVALID_WIDTH', 'youtube', '100'), $crawler->filter('.errorbox')->html());
154154

155155
// Test settings module width success
156-
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=settings&sid={$this->sid}");
156+
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=settings&sid=$this->sid");
157157
$this->assertContainsLang('ACP_MEDIA_SETTINGS', $crawler->filter('#main')->text(), 'The Media Embed settings module failed to load');
158158
$form_data = [
159159
'media_embed_max_width' => "vimeo:100px\nyoutube:100%",
@@ -164,7 +164,7 @@ public function test_acp_modules()
164164
self::assertGreaterThan(0, $crawler->filter('.successbox')->count());
165165

166166
// Test manage sites module
167-
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid={$this->sid}");
167+
$crawler = self::request('GET', "adm/index.php?i=\\phpbb\\mediaembed\\acp\\main_module&mode=manage&sid=$this->sid");
168168
$this->assertContainsLang('ACP_MEDIA_MANAGE', $crawler->filter('#main')->text(), 'The Media Embed settings module failed to load');
169169

170170
$this->assert_checkbox_is_checked($crawler, 'youtube');

0 commit comments

Comments
 (0)