[ticket/715] Resolve issues with portal and tests on PHP 8.0

B3P-715
This commit is contained in:
Marc Alexander
2021-09-04 11:09:52 +02:00
parent 9eb415b79c
commit ed54e3ef0c
30 changed files with 233 additions and 143 deletions

View File

@@ -63,10 +63,10 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
$crawler = self::request('GET', $module_link);
preg_match('/module_classname=(?:([a-z0-9\\\_]+))/', $module_link, $module_name);
$module_name = $module_name[1];
$this->assertContains('Are you sure you wish to delete the module', $crawler->text());
$this->assertStringContainsString('Are you sure you wish to delete the module', $crawler->text());
$form = $crawler->selectButton('confirm')->form();
$crawler = self::submit($form);
$this->assertContains('The module was removed successfully.', $crawler->text());
$this->assertStringContainsString('The module was removed successfully.', $crawler->text());
// Add it back
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=modules&add[center]=true&module_column=2&sid=' . $this->sid);
@@ -85,7 +85,7 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
// Take a look at the logs
$crawler = self::request('GET', 'adm/index.php?i=acp_logs&mode=admin&sid=' . $this->sid);
$this->assertContains(strip_tags(html_entity_decode($this->lang('LOG_PORTAL_CONFIG', $this->lang('ACP_PORTAL_GENERAL_INFO')), ENT_COMPAT, 'UTF-8')), $crawler->text());
$this->assertStringContainsString(strip_tags(html_entity_decode($this->lang('LOG_PORTAL_CONFIG', $this->lang('ACP_PORTAL_GENERAL_INFO')), ENT_COMPAT, 'UTF-8')), $crawler->text());
}
public function test_portal_permissions()
@@ -105,9 +105,9 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
$form->setValues(array('link_title' => 'foobar'));
$crawler = self::submit($form);
$crawler = self::request('GET', 'adm/index.php?i=\board3\portal\acp\portal_module&mode=config&module_id=1&sid=' . $this->sid);
$this->assertContains('foobar', $crawler->text());
$this->assertStringContainsString('foobar', $crawler->text());
$crawler = self::request('GET', 'app.php/portal?sid=' . $this->sid);
$this->assertContains('foobar', $crawler->text());
$this->assertStringContainsString('foobar', $crawler->text());
}
public function data_add_second_module()
@@ -131,6 +131,6 @@ class phpbb_functional_portal_acp_test extends \board3\portal\tests\testframewor
$form = $crawler->selectButton('submit')->form();
$form['module_classname']->disableValidation()->select($module_class);
$crawler = self::submit($form);
$this->assertContains($expected_message, $crawler->text());
$this->assertStringContainsString($expected_message, $crawler->text());
}
}

View File

@@ -60,6 +60,8 @@ class phpbb_functional_portal_announcement_test extends \board3\portal\tests\tes
public function test_shortened_message()
{
$this->purge_cache();
// Create topic as announcement
$data = $this->create_topic(2, 'Portal-announce-global', str_repeat('This is a global announcement for the portal', 6), array(
'topic_type' => POST_GLOBAL,
@@ -69,7 +71,7 @@ class phpbb_functional_portal_announcement_test extends \board3\portal\tests\tes
{
// no errors should appear on portal
$crawler = self::request('GET', 'app.php/portal');
$this->assertContains('This is a global announc ...', $crawler->text());
$this->assertStringContainsString('This is a global announc ...', $crawler->text());
}
}
}

View File

@@ -47,6 +47,6 @@ class phpbb_functional_portal_birthday_list_test extends \board3\portal\tests\te
public function test_after_announce()
{
$crawler = self::request('GET', 'app.php/portal');
$this->assertContains(date('d M', time() + 86400*2), $crawler->html());
$this->assertStringContainsString(date('d M', time() + 86400*2), $crawler->html());
}
}

View File

@@ -23,7 +23,7 @@ class phpbb_functional_portal_link_test extends \board3\portal\tests\testframewo
public function test_portal_link()
{
$crawler = self::request('GET', 'index.php?sid=' . $this->sid);
$this->assertContains('Portal', $crawler->text());
$this->assertStringContainsString('Portal', $crawler->text());
}
public function test_disabled_portal_link()
@@ -46,7 +46,7 @@ class phpbb_functional_portal_link_test extends \board3\portal\tests\testframewo
});
foreach ($vals as $val)
{
$this->assertNotContains('Portal', $val);
$this->assertStringNotContainsString('Portal', $val);
}
// Try to access portal directly
@@ -56,7 +56,7 @@ class phpbb_functional_portal_link_test extends \board3\portal\tests\testframewo
});
foreach ($vals as $val)
{
$this->assertNotContains('Portal', $val);
$this->assertStringNotContainsString('Portal', $val);
}
// Enable portal again

View File

@@ -42,7 +42,7 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
public function test_portal_all_pages($style_id)
{
$crawler = self::request('GET', 'index.php?style=' . $style_id);
$this->assertNotContains('Menu', $crawler->text());
$this->assertStringNotContainsString('Menu', $crawler->text());
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
@@ -54,7 +54,7 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
$crawler = self::request('GET', 'index.php?style=' . $style_id);
$this->assertContains('Menu', $crawler->text());
$this->assertStringContainsString('Menu', $crawler->text());
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
@@ -66,8 +66,8 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
$crawler = self::request('GET', 'index.php?style=' . $style_id);
$this->assertNotContains('Board Style', $crawler->text());
$this->assertContains('User menu', $crawler->text());
$this->assertStringNotContainsString('Board Style', $crawler->text());
$this->assertStringContainsString('User menu', $crawler->text());
$crawler = self::request('GET', 'adm/index.php?i=-board3-portal-acp-portal_module&mode=config&sid=' . $this->sid);
@@ -79,6 +79,6 @@ class phpbb_functional_portal_no_error_test extends \board3\portal\tests\testfra
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
$crawler = self::request('GET', 'index.php?style=' . $style_id);
$this->assertNotContains('Menu', $crawler->text());
$this->assertStringNotContainsString('Menu', $crawler->text());
}
}

View File

@@ -29,13 +29,13 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra
}
else
{
$mod_rewrite = (getenv('HTTP_MOD_REWRITE')=='On') ? true : false;
$mod_rewrite = getenv('HTTP_MOD_REWRITE') == 'On';
}
if ($mod_rewrite)
{
$crawler = self::request('GET', '');
$this->assertContains('Board3 Portal', $crawler->text());
$this->assertStringContainsString('Board3 Portal', $crawler->text());
}
}
@@ -44,7 +44,7 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra
// Make sure we are logged out
$this->logout();
$crawler = self::request('GET', 'app.php/portal?sid=' . $this->sid);
$crawler = self::request('GET', 'app.php/portal');
$form = $crawler->selectButton('Login')->form();
$form->setValues(array(
'username' => 'admin',
@@ -54,6 +54,6 @@ class phpbb_functional_portal_redirect_test extends \board3\portal\tests\testfra
$crawler = self::submit($form);
// Should be redirected to portal and logged in
$this->assertContains('Site Admin', $crawler->text());
$this->assertStringContainsString('Site Admin', $crawler->text());
}
}

View File

@@ -103,8 +103,8 @@ class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests
$crawler = self::request('GET', 'app.php/portal');
$legend = $crawler->filter('dd.portal-responsive-show p em')->text();
$this->assertContains('Administrators', $legend);
$this->assertContains('Global moderators', $legend);
$this->assertStringContainsString('Administrators', $legend);
$this->assertStringContainsString('Global moderators', $legend);
}
public function test_setup_hidden_forum()
@@ -121,7 +121,7 @@ class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests
$form = $crawler->selectButton('Submit')->form();
$form['forum_perm_from']->select(2);
$crawler = self::submit($form);
$this->assertContains('Forum created successfully', $crawler->text());
$this->assertStringContainsString('Forum created successfully', $crawler->text());
// Hide forum using permissions from registered users
$crawler = self::request('GET', 'adm/index.php?i=acp_permissions&mode=setting_group_local&sid=' . $this->sid);
@@ -180,8 +180,8 @@ class phpbb_functional_portal_visit_registered_test extends \board3\portal\tests
$this->logout();
$this->login('standard-user');
$crawler = self::request('GET', 'index.php');
$this->assertNotContains('Hidden forum', $crawler->text());
$this->assertStringNotContainsString('Hidden forum', $crawler->text());
$crawler = self::request('GET', 'app.php/portal');
$this->assertNotContains('Hidden topic', $crawler->text());
$this->assertStringNotContainsString('Hidden topic', $crawler->text());
}
}

View File

@@ -33,10 +33,10 @@ class phpbb_functional_portal_vote_poll_test extends \board3\portal\tests\testfr
$crawler = self::request('GET', 'app.php/portal');
$form = $crawler->selectButton('Submit vote')->form();
$form->setValues(array('vote_id' => array(1)));
$crawler = self::submit($form);
self::submit($form);
// no errors should appear on portal
$crawler = self::request('GET', 'app.php/portal');
self::request('GET', 'app.php/portal');
}
}
@@ -46,6 +46,6 @@ class phpbb_functional_portal_vote_poll_test extends \board3\portal\tests\testfr
public function test_after_poll()
{
$this->logout();
$crawler = self::request('GET', 'app.php/portal');
self::request('GET', 'app.php/portal');
}
}