Skip to content

Commit 9bfff6c

Browse files
committed
Update tests
1 parent 1bd5c0f commit 9bfff6c

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
backupGlobals="true"
55
backupStaticAttributes="false"
66
colors="true"

tests/controller/acp_controller_test.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,14 @@ public function test_action_move($id, $dir, $valid, $error, $is_ajax)
575575
if ($is_ajax)
576576
{
577577
// Handle trigger_error() output called from json_response
578-
$this->setExpectedTriggerError(E_WARNING);
578+
if (version_compare(\PHPUnit\Runner\Version::id(), '10.0.0', '>='))
579+
{
580+
$this->markTestSkipped('setExpectedTriggerError not available in PHPUnit 10+');
581+
}
582+
else
583+
{
584+
$this->setExpectedTriggerError(E_WARNING);
585+
}
579586
}
580587

581588
$variable_invocation = 0;

tests/controller/controller_test.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
use phpbb\lock\db;
2222
use phpbb_database_test_case;
2323
use phpbb_mock_event_dispatcher;
24-
use PHPUnit\DbUnit\DataSet\DefaultDataSet;
25-
use PHPUnit\DbUnit\DataSet\IDataSet;
26-
use PHPUnit\DbUnit\DataSet\XmlDataSet;
2724
use phpbb\path_helper;
2825
use phpbb\user;
2926
use PHPUnit\Framework\Exception;
@@ -50,7 +47,7 @@ protected static function setup_extensions(): array
5047
/**
5148
* Get data set fixtures
5249
*/
53-
public function getDataSet(): IDataSet|XmlDataSet|DefaultDataSet
50+
public function getDataSet()
5451
{
5552
return $this->createXMLDataSet(__DIR__ . '/../fixtures/board_announcements.xml');
5653
}
@@ -191,11 +188,10 @@ public function controller_data(): array
191188
*/
192189
public function test_controller($id, $user_id, $is_registered, $mode, $ajax, $status_code, $content, $expected)
193190
{
194-
// If a non-ajax redirect is encountered, in testing it will trigger_error/exception
191+
// If a non-ajax redirect is encountered, in testing it will trigger_error
195192
if (!$ajax)
196193
{
197-
$this->expectException(Exception::class);
198-
$this->expectExceptionMessage('INSECURE_REDIRECT');
194+
$this->setExpectedTriggerError(E_USER_DEPRECATED);
199195
}
200196

201197
$controller = $this->get_controller($user_id, $is_registered, $mode, $ajax);

tests/event/listener_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected static function setup_extensions()
5959
/**
6060
* Get data set fixtures
6161
*
62-
* @return \PHPUnit\DbUnit\DataSet\DefaultDataSet|\PHPUnit\DbUnit\DataSet\XmlDataSet
62+
* @return \PHPUnit\DbUnit\DataSet\XmlDataSet
6363
*/
6464
public function getDataSet()
6565
{

0 commit comments

Comments
 (0)