Skip to content

Commit 59cec83

Browse files
committed
Update old code in unit tests
1 parent aecd726 commit 59cec83

5 files changed

Lines changed: 8 additions & 9 deletions

File tree

tests/controller/index_controller_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ public function controller_exception_test_data()
5858
* Basic controller exception test
5959
*
6060
* @dataProvider controller_exception_test_data
61-
* @expectedException \phpbb\exception\http_exception
6261
*/
6362
public function test_controller_exception($forum)
6463
{
64+
$this->expectException(\phpbb\exception\http_exception::class);
6565
$this->config['ideas_forum_id'] = $forum;
6666

6767
/** @var \phpbb\ideas\controller\index_controller $controller */

tests/controller/list_controller_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ public function controller_exception_test_data()
189189
* Basic controller exception test
190190
*
191191
* @dataProvider controller_exception_test_data
192-
* @expectedException \phpbb\exception\http_exception
193192
*/
194193
public function test_controller_exception($forum)
195194
{
195+
$this->expectException(\phpbb\exception\http_exception::class);
196196
$this->config['ideas_forum_id'] = $forum;
197197

198198
/** @var \phpbb\ideas\controller\list_controller $controller */

tests/functional/ideas_test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public function test_new_idea()
4444
$this->assertContains($this->lang('IDEAS'), $crawler->filter('#nav-breadcrumbs')->text());
4545
$this->assertContains($idea['title'], $crawler->filter('h2')->text());
4646
$this->assertContains($idea['message'], $crawler->filter('.content')->text());
47-
$this->assertContains('1', $crawler->filter('.rating > .vote-up')->text());
48-
$this->assertContains('0', $crawler->filter('.rating > .vote-down')->text());
47+
$this->assertStringContainsString('1', $crawler->filter('.rating > .vote-up')->text());
48+
$this->assertStringContainsString('0', $crawler->filter('.rating > .vote-down')->text());
4949
}
5050

5151
/**
@@ -131,7 +131,7 @@ public function create_idea($title, $message)
131131

132132
// Submit and verify success
133133
$crawler = self::submit($form);
134-
$this->assertContains($data['title'], $crawler->filter('h2')->text());
134+
$this->assertStringContainsString($data['title'], $crawler->filter('h2')->text());
135135

136136
// Get the new idea's ID and add it to the data array
137137
$url = $crawler->selectLink($this->lang('REMOVE_VOTE'))->link()->getUri();

tests/functional/viewonline_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function test_viewonline_check_viewonline()
4141
$crawler = self::request('GET', "viewonline.php?sid={$this->sid}");
4242

4343
// Is admin still viewing Ideas page
44-
$this->assertContains('admin', $crawler->filter('#page-body table.table1')->text());
44+
$this->assertStringContainsString('admin', $crawler->filter('#page-body table.table1')->text());
4545

4646
$session_entries = $crawler->filter('#page-body table.table1 tr')->count();
4747
$this->assertGreaterThanOrEqual(3, $session_entries, 'Too few session entries found');
@@ -54,7 +54,7 @@ public function test_viewonline_check_viewonline()
5454
$subcrawler = $crawler->filter('#page-body table.table1 tr')->eq($i);
5555
if (strpos($subcrawler->filter('td')->text(), 'admin') !== false)
5656
{
57-
$this->assertContains($this->lang('VIEWING_IDEAS'), $subcrawler->filter('td.info')->text());
57+
$this->assertContainsLang('VIEWING_IDEAS', $subcrawler->filter('td.info')->text());
5858
return;
5959
}
6060
}

tests/template/status_icon_test.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ protected function setup_engine(array $new_config = array())
4141

4242
$this->template_path = $this->test_path . '/templates';
4343

44-
$container = new \phpbb_mock_container_builder();
4544
$cache_path = $phpbb_root_path . 'cache/twig';
4645
$context = new \phpbb\template\context();
4746
$loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), '');
@@ -52,7 +51,7 @@ protected function setup_engine(array $new_config = array())
5251
$cache_path,
5352
null,
5453
$loader,
55-
new \phpbb\event\dispatcher($container),
54+
new \phpbb\event\dispatcher(),
5655
[
5756
'cache' => false,
5857
'debug' => false,

0 commit comments

Comments
 (0)