diff --git a/composer.json b/composer.json index 575ba887f..e855cf024 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.2", "phpstan/phpstan-deprecation-rules": "^1.0", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^9.6 || ^10.0 || ^11.0", "roundcube/acl": "*", "roundcube/additional_message_headers": "*", "roundcube/archive": "*", diff --git a/plugins/attachment_reminder/tests/Browser/PluginTest.php b/plugins/attachment_reminder/tests/Browser/PluginTest.php index 4c2ce026f..a0d4983e6 100644 --- a/plugins/attachment_reminder/tests/Browser/PluginTest.php +++ b/plugins/attachment_reminder/tests/Browser/PluginTest.php @@ -2,6 +2,7 @@ namespace Tests\Browser\Plugins\AttachmentReminder; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\Dialog; use Roundcube\Tests\Browser\TestCase; @@ -60,6 +61,7 @@ class PluginTest extends TestCase * * @depends testPreferences */ + #[Depends('testPreferences')] public function testMailCompose() { $this->browse(static function ($browser) { diff --git a/plugins/managesieve/tests/ManagesieveEngineTest.php b/plugins/managesieve/tests/ManagesieveEngineTest.php index a719d0b6d..bda1764b2 100644 --- a/plugins/managesieve/tests/ManagesieveEngineTest.php +++ b/plugins/managesieve/tests/ManagesieveEngineTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Plugins\Tests; +use PHPUnit\Framework\Attributes\DataProvider; use Roundcube\Tests\ActionTestCase; use function Roundcube\Tests\invokeMethod; @@ -67,6 +68,7 @@ class ManagesieveEngineTest extends ActionTestCase * * @dataProvider provide_strip_value_cases */ + #[DataProvider('provide_strip_value_cases')] public function test_strip_value($expected, $args) { $rcube = \rcube::get_instance(); diff --git a/plugins/managesieve/tests/ManagesieveScriptTest.php b/plugins/managesieve/tests/ManagesieveScriptTest.php index 32fa97293..ab65d1455 100644 --- a/plugins/managesieve/tests/ManagesieveScriptTest.php +++ b/plugins/managesieve/tests/ManagesieveScriptTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Plugins\Tests; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ManagesieveScriptTest extends TestCase @@ -11,6 +12,7 @@ class ManagesieveScriptTest extends TestCase * * @dataProvider provide_parser_cases */ + #[DataProvider('provide_parser_cases')] public function test_parser($input, $output, $message) { // get capabilities list from the script @@ -75,6 +77,7 @@ class ManagesieveScriptTest extends TestCase /** * @dataProvider provide_tokenizer_cases */ + #[DataProvider('provide_tokenizer_cases')] public function test_tokenizer($num, $input, $output) { $res = json_encode(\rcube_sieve_script::tokenize($input, $num)); diff --git a/plugins/markasjunk/tests/Browser/MailTest.php b/plugins/markasjunk/tests/Browser/MailTest.php index bec364c8b..77e454390 100644 --- a/plugins/markasjunk/tests/Browser/MailTest.php +++ b/plugins/markasjunk/tests/Browser/MailTest.php @@ -2,6 +2,7 @@ namespace Tests\Browser\Plugins\Markasjunk; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\TestCase; @@ -93,6 +94,7 @@ class MailTest extends TestCase * * @depends testMailUI */ + #[Depends('testMailUI')] public function testMailView() { $this->browse(static function ($browser) { diff --git a/tests/Actions/Contacts/ExportTest.php b/tests/Actions/Contacts/ExportTest.php index f49bcf78f..7e6b5c247 100644 --- a/tests/Actions/Contacts/ExportTest.php +++ b/tests/Actions/Contacts/ExportTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Actions\Contacts; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\ActionTestCase; use Roundcube\Tests\OutputHtmlMock; use Roundcube\Tests\StderrMock; @@ -56,6 +57,7 @@ class ExportTest extends ActionTestCase * * @depends test_export_all */ + #[Depends('test_export_all')] public function test_export_selected() { $action = new \rcmail_action_contacts_export(); @@ -99,6 +101,7 @@ class ExportTest extends ActionTestCase * * @depends test_export_all */ + #[Depends('test_export_all')] public function test_export_search() { $this->markTestIncomplete(); diff --git a/tests/Actions/Mail/IndexTest.php b/tests/Actions/Mail/IndexTest.php index 65a080dda..0a4969197 100644 --- a/tests/Actions/Mail/IndexTest.php +++ b/tests/Actions/Mail/IndexTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Actions\Mail; +use PHPUnit\Framework\Attributes\Group; use Roundcube\Tests\ActionTestCase; use function Roundcube\Tests\setProperty; @@ -433,6 +434,7 @@ class IndexTest extends ActionTestCase * * @group mbstring */ + #[Group('mbstring')] public function test_washtml_utf8() { $this->initOutput(\rcmail_action::MODE_HTTP, 'mail', ''); diff --git a/tests/Actions/Mail/SearchTest.php b/tests/Actions/Mail/SearchTest.php index bb8c16528..371602e7d 100644 --- a/tests/Actions/Mail/SearchTest.php +++ b/tests/Actions/Mail/SearchTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Actions\Mail; +use PHPUnit\Framework\Attributes\DataProvider; use Roundcube\Tests\ActionTestCase; use Roundcube\Tests\OutputJsonMock; @@ -290,6 +291,7 @@ class SearchTest extends ActionTestCase * * @dataProvider provide_search_input_cases */ + #[DataProvider('provide_search_input_cases')] public function test_search_input($input, $output) { if (is_array($input)) { @@ -328,6 +330,7 @@ class SearchTest extends ActionTestCase * * @dataProvider provide_search_interval_criteria_cases */ + #[DataProvider('provide_search_interval_criteria_cases')] public function test_search_interval_criteria($input, $output) { $result = \rcmail_action_mail_search::search_interval_criteria($input); diff --git a/tests/Browser/Contacts/ExportTest.php b/tests/Browser/Contacts/ExportTest.php index 52ee6aec9..22b71dee2 100644 --- a/tests/Browser/Contacts/ExportTest.php +++ b/tests/Browser/Contacts/ExportTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Contacts; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\TestCase; @@ -41,6 +42,7 @@ class ExportTest extends TestCase * * @depends testExportAll */ + #[Depends('testExportAll')] public function testExportSelected() { $this->browse(function ($browser) { diff --git a/tests/Browser/Contacts/GroupsTest.php b/tests/Browser/Contacts/GroupsTest.php index bccb79288..64deb2082 100644 --- a/tests/Browser/Contacts/GroupsTest.php +++ b/tests/Browser/Contacts/GroupsTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Contacts; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\Dialog; use Roundcube\Tests\Browser\Components\Popupmenu; @@ -94,6 +95,7 @@ class GroupsTest extends TestCase * * @depends testGroupCreate */ + #[Depends('testGroupCreate')] public function testGroupRename() { $this->browse(static function ($browser) { @@ -146,6 +148,7 @@ class GroupsTest extends TestCase * * @depends testGroupRename */ + #[Depends('testGroupRename')] public function testGroupDelete() { $this->browse(static function ($browser) { diff --git a/tests/Browser/Contacts/ImportTest.php b/tests/Browser/Contacts/ImportTest.php index 969f52eb8..3439fb798 100644 --- a/tests/Browser/Contacts/ImportTest.php +++ b/tests/Browser/Contacts/ImportTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Contacts; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\App; use Roundcube\Tests\Browser\Components\Dialog; @@ -61,6 +62,7 @@ class ImportTest extends TestCase * * @depends testImportUI */ + #[Depends('testImportUI')] public function testImportProcess() { $this->browse(static function ($browser) { @@ -103,6 +105,7 @@ class ImportTest extends TestCase * * @depends testImportProcess */ + #[Depends('testImportProcess')] public function testImportResult() { $this->browse(static function ($browser) { diff --git a/tests/Browser/Mail/ComposeTest.php b/tests/Browser/Mail/ComposeTest.php index b9c8b2837..a157dcea8 100644 --- a/tests/Browser/Mail/ComposeTest.php +++ b/tests/Browser/Mail/ComposeTest.php @@ -3,6 +3,7 @@ namespace Roundcube\Tests\Browser\Mail; use Facebook\WebDriver\WebDriverKeys; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\App; use Roundcube\Tests\Browser\Components\HtmlEditor; @@ -83,6 +84,7 @@ class ComposeTest extends TestCase /** * @depends testCompose */ + #[Depends('testCompose')] public function testPlainEditor() { // Test for #7230: Shift+PageUp text selection @@ -114,6 +116,7 @@ class ComposeTest extends TestCase /** * @depends testCompose */ + #[Depends('testCompose')] public function testRecipientInput() { // Test for #7231: Recipient input bug when using click diff --git a/tests/Browser/Mail/ListTest.php b/tests/Browser/Mail/ListTest.php index 066a8cbc5..418a74a52 100644 --- a/tests/Browser/Mail/ListTest.php +++ b/tests/Browser/Mail/ListTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Mail; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\Toolbarmenu; use Roundcube\Tests\Browser\TestCase; @@ -94,6 +95,7 @@ class ListTest extends TestCase /** * @depends testList */ + #[Depends('testList')] public function testListSelection() { $this->browse(static function ($browser) { diff --git a/tests/Browser/Mail/PreviewTest.php b/tests/Browser/Mail/PreviewTest.php index cfd680fef..488f376ad 100644 --- a/tests/Browser/Mail/PreviewTest.php +++ b/tests/Browser/Mail/PreviewTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Mail; +use PHPUnit\Framework\Attributes\Group; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\Dialog; use Roundcube\Tests\Browser\TestCase; @@ -135,6 +136,7 @@ class PreviewTest extends TestCase * * @group failsonga-phone */ + #[Group('failsonga-phone')] public function testPreviewMorelink() { $this->browse(static function ($browser) { diff --git a/tests/Browser/Settings/FoldersTest.php b/tests/Browser/Settings/FoldersTest.php index 1295dce60..c58d2731d 100644 --- a/tests/Browser/Settings/FoldersTest.php +++ b/tests/Browser/Settings/FoldersTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Settings; +use PHPUnit\Framework\Attributes\Group; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\App; use Roundcube\Tests\Browser\TestCase; @@ -73,6 +74,8 @@ class FoldersTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testFolderCreate() { $this->browse(static function ($browser) { diff --git a/tests/Browser/Settings/IdentitiesTest.php b/tests/Browser/Settings/IdentitiesTest.php index ce6f762cd..77d61af20 100644 --- a/tests/Browser/Settings/IdentitiesTest.php +++ b/tests/Browser/Settings/IdentitiesTest.php @@ -2,6 +2,8 @@ namespace Roundcube\Tests\Browser\Settings; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\App; use Roundcube\Tests\Browser\Components\Dialog; @@ -48,6 +50,8 @@ class IdentitiesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testIdentityCreate() { $this->browse(static function ($browser) { @@ -148,6 +152,9 @@ class IdentitiesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Depends('testIdentityCreate')] + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testIdentityDelete() { $this->browse(static function ($browser) { @@ -187,6 +194,9 @@ class IdentitiesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Depends('testIdentityDelete')] + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testIdentityUpdate() { $this->browse(static function ($browser) { @@ -235,6 +245,9 @@ class IdentitiesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Depends('testIdentityUpdate')] + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testIdentitiesInComposer() { // Add one more identity diff --git a/tests/Browser/Settings/Preferences/GeneralTest.php b/tests/Browser/Settings/Preferences/GeneralTest.php index 28d253d02..517e7222f 100644 --- a/tests/Browser/Settings/Preferences/GeneralTest.php +++ b/tests/Browser/Settings/Preferences/GeneralTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Browser\Settings\Preferences; +use PHPUnit\Framework\Attributes\Depends; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\App; use Roundcube\Tests\Browser\TestCase; @@ -102,6 +103,7 @@ class GeneralTest extends TestCase * * @depends testGeneral */ + #[Depends('testGeneral')] public function testPreferencesChange() { // Values we're changing to diff --git a/tests/Browser/Settings/ResponsesTest.php b/tests/Browser/Settings/ResponsesTest.php index 9e294627e..32273929e 100644 --- a/tests/Browser/Settings/ResponsesTest.php +++ b/tests/Browser/Settings/ResponsesTest.php @@ -2,6 +2,8 @@ namespace Roundcube\Tests\Browser\Settings; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use Roundcube\Tests\Browser\Bootstrap; use Roundcube\Tests\Browser\Components\App; use Roundcube\Tests\Browser\Components\Dialog; @@ -49,6 +51,8 @@ class ResponsesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testResponseCreate() { \rcmail::get_instance()->get_dbh()->exec_script(" @@ -133,6 +137,9 @@ class ResponsesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Depends('testResponseCreate')] + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testResponseDelete() { $this->browse(static function ($browser) { @@ -170,6 +177,9 @@ class ResponsesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Depends('testResponseDelete')] + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testResponsesInComposer() { $this->browse(static function ($browser) { @@ -216,6 +226,9 @@ class ResponsesTest extends TestCase * @group failsontravis-phone * @group failsonga-phone */ + #[Depends('testResponsesInComposer')] + #[Group('failsontravis-phone')] + #[Group('failsonga-phone')] public function testResponseUpdate() { $this->browse(static function ($browser) { diff --git a/tests/Browser/TestCase.php b/tests/Browser/TestCase.php index 103d07f7d..cd62027dd 100644 --- a/tests/Browser/TestCase.php +++ b/tests/Browser/TestCase.php @@ -7,6 +7,7 @@ use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; use Laravel\Dusk\Chrome\SupportsChrome; use Laravel\Dusk\Concerns\ProvidesBrowser; +use PHPUnit\Framework\Attributes\BeforeClass; use PHPUnit\Framework\TestCase as PHPUnitTestCase; use Symfony\Component\Finder\Exception\DirectoryNotFoundException; use Symfony\Component\Finder\Finder; @@ -33,6 +34,7 @@ abstract class TestCase extends PHPUnitTestCase * * @beforeClass */ + #[BeforeClass] public static function prepare(): void { static::startWebServer(); @@ -118,7 +120,7 @@ abstract class TestCase extends PHPUnitTestCase // Purge screenshots from the last test run $pattern = sprintf('failure-%s_%s-*', str_replace('\\', '_', static::class), - $this->getName(false) + method_exists($this, 'getName') ? $this->getName(false) : $this->name() ); try { @@ -133,7 +135,7 @@ abstract class TestCase extends PHPUnitTestCase // Purge console logs from the last test run $pattern = sprintf('%s_%s-*', str_replace('\\', '_', static::class), - $this->getName(false) + method_exists($this, 'getName') ? $this->getName(false) : $this->name() ); try { diff --git a/tests/Framework/BaseReplacerTest.php b/tests/Framework/BaseReplacerTest.php index efcd6c7c0..92420bd85 100644 --- a/tests/Framework/BaseReplacerTest.php +++ b/tests/Framework/BaseReplacerTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -54,6 +55,7 @@ class BaseReplacerTest extends TestCase * * @dataProvider provide_absolute_url_cases */ + #[DataProvider('provide_absolute_url_cases')] public function test_absolute_url($path, $base, $expected) { $replacer = new \rcube_base_replacer('test'); diff --git a/tests/Framework/BrowserTest.php b/tests/Framework/BrowserTest.php index 5287d219d..37991aceb 100644 --- a/tests/Framework/BrowserTest.php +++ b/tests/Framework/BrowserTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -12,6 +13,7 @@ class BrowserTest extends TestCase /** * @dataProvider provide_browser_cases */ + #[DataProvider('provide_browser_cases')] public function test_browser($useragent, $opera, $chrome, $ie, $edge, $safari, $mz) { $object = $this->getBrowser($useragent); @@ -27,6 +29,7 @@ class BrowserTest extends TestCase /** * @dataProvider provide_os_cases */ + #[DataProvider('provide_os_cases')] public function test_os($useragent, $windows, $linux, $unix, $mac) { $object = $this->getBrowser($useragent); @@ -40,6 +43,7 @@ class BrowserTest extends TestCase /** * @dataProvider provide_version_cases */ + #[DataProvider('provide_version_cases')] public function test_version($useragent, $version) { $object = $this->getBrowser($useragent); diff --git a/tests/Framework/CharsetTest.php b/tests/Framework/CharsetTest.php index c50dd508b..1098b4b3f 100644 --- a/tests/Framework/CharsetTest.php +++ b/tests/Framework/CharsetTest.php @@ -2,6 +2,8 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; /** @@ -9,6 +11,7 @@ use PHPUnit\Framework\TestCase; * * @group mbstring */ +#[Group('mbstring')] class CharsetTest extends TestCase { /** @@ -30,6 +33,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_clean_cases */ + #[DataProvider('provide_clean_cases')] public function test_clean($input, $output) { $this->assertSame($output, \rcube_charset::clean($input)); @@ -59,6 +63,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_is_valid_cases */ + #[DataProvider('provide_is_valid_cases')] public function test_is_valid($input, $result) { $this->assertSame($result, \rcube_charset::is_valid($input)); @@ -78,6 +83,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_parse_charset_cases */ + #[DataProvider('provide_parse_charset_cases')] public function test_parse_charset($input, $output) { $this->assertSame($output, \rcube_charset::parse_charset($input)); @@ -114,6 +120,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_convert_cases */ + #[DataProvider('provide_convert_cases')] public function test_convert($input, $output, $from, $to) { $this->assertSame($output, \rcube_charset::convert($input, $from, $to)); @@ -132,6 +139,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_utf7_to_utf8_cases */ + #[DataProvider('provide_utf7_to_utf8_cases')] public function test_utf7_to_utf8($input, $output) { // @phpstan-ignore-next-line @@ -151,6 +159,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_utf7imap_to_utf8_cases */ + #[DataProvider('provide_utf7imap_to_utf8_cases')] public function test_utf7imap_to_utf8($input, $output) { // @phpstan-ignore-next-line @@ -170,6 +179,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_utf8_to_utf7imap_cases */ + #[DataProvider('provide_utf8_to_utf7imap_cases')] public function test_utf8_to_utf7imap($input, $output) { // @phpstan-ignore-next-line @@ -189,6 +199,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_utf16_to_utf8_cases */ + #[DataProvider('provide_utf16_to_utf8_cases')] public function test_utf16_to_utf8($input, $output) { // @phpstan-ignore-next-line @@ -209,6 +220,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_detect_cases */ + #[DataProvider('provide_detect_cases')] public function test_detect($input, $fallback, $output) { // @phpstan-ignore-next-line @@ -228,6 +240,7 @@ class CharsetTest extends TestCase /** * @dataProvider provide_detect_with_lang_cases */ + #[DataProvider('provide_detect_with_lang_cases')] public function test_detect_with_lang($input, $lang, $output) { // @phpstan-ignore-next-line diff --git a/tests/Framework/DBMysqlTest.php b/tests/Framework/DBMysqlTest.php index b2a8a3891..a7c7e3bc1 100644 --- a/tests/Framework/DBMysqlTest.php +++ b/tests/Framework/DBMysqlTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; /** @@ -10,6 +11,8 @@ use PHPUnit\Framework\TestCase; * @group database * @group mysql */ +#[Group('database')] +#[Group('mysql')] class DBMysqlTest extends TestCase { /** diff --git a/tests/Framework/DBPgsqlTest.php b/tests/Framework/DBPgsqlTest.php index 42375dd42..1c720f0b3 100644 --- a/tests/Framework/DBPgsqlTest.php +++ b/tests/Framework/DBPgsqlTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function Roundcube\Tests\invokeMethod; @@ -12,6 +13,8 @@ use function Roundcube\Tests\invokeMethod; * @group database * @group postgres */ +#[Group('database')] +#[Group('postgres')] class DBPgsqlTest extends TestCase { /** diff --git a/tests/Framework/DBSqliteTest.php b/tests/Framework/DBSqliteTest.php index d5804b7a7..74298e6ed 100644 --- a/tests/Framework/DBSqliteTest.php +++ b/tests/Framework/DBSqliteTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; /** @@ -10,6 +11,8 @@ use PHPUnit\Framework\TestCase; * @group database * @group sqlite */ +#[Group('database')] +#[Group('sqlite')] class DBSqliteTest extends TestCase { /** diff --git a/tests/Framework/DBTest.php b/tests/Framework/DBTest.php index a59745e29..2ccd78725 100644 --- a/tests/Framework/DBTest.php +++ b/tests/Framework/DBTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; /** @@ -9,6 +10,7 @@ use PHPUnit\Framework\TestCase; * * @group database */ +#[Group('database')] class DBTest extends TestCase { /** diff --git a/tests/Framework/EnrichedTest.php b/tests/Framework/EnrichedTest.php index ff25144d9..bd625d447 100644 --- a/tests/Framework/EnrichedTest.php +++ b/tests/Framework/EnrichedTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -67,6 +68,7 @@ class EnrichedTest extends TestCase * * @dataProvider provide_formatting_cases */ + #[DataProvider('provide_formatting_cases')] public function test_formatting($enriched, $expected) { $result = \rcube_enriched::to_html($enriched); diff --git a/tests/Framework/Html2textTest.php b/tests/Framework/Html2textTest.php index f4407213a..8ba8d4d28 100644 --- a/tests/Framework/Html2textTest.php +++ b/tests/Framework/Html2textTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -97,6 +98,7 @@ class Html2textTest extends TestCase /** * @dataProvider provide_html2text_cases */ + #[DataProvider('provide_html2text_cases')] public function test_html2text($title, $in, $out) { $ht = new \rcube_html2text(null, false, \rcube_html2text::LINKS_NONE); @@ -252,6 +254,7 @@ Links: * * @dataProvider provide_links_no_list_cases */ + #[DataProvider('provide_links_no_list_cases')] public function test_links_no_list($input, $output) { $h2t = new \rcube_html2text($input, false, \rcube_html2text::LINKS_NONE); @@ -265,6 +268,7 @@ Links: * * @dataProvider provide_links_no_list_cases */ + #[DataProvider('provide_links_no_list_cases')] public function test_links_no_list_bc_with_boolean($input, $output) { $h2t = new \rcube_html2text($input, false, false); diff --git a/tests/Framework/HtmlTest.php b/tests/Framework/HtmlTest.php index 0e1bdf55e..4e9472426 100644 --- a/tests/Framework/HtmlTest.php +++ b/tests/Framework/HtmlTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -63,6 +64,7 @@ class HtmlTest extends TestCase * * @dataProvider provide_attrib_string_cases */ + #[DataProvider('provide_attrib_string_cases')] public function test_attrib_string($arg1, $arg2, $expected) { $this->assertSame($expected, \html::attrib_string($arg1, $arg2)); @@ -89,6 +91,7 @@ class HtmlTest extends TestCase * * @dataProvider provide_quote_cases */ + #[DataProvider('provide_quote_cases')] public function test_quote($str, $expected) { $this->assertSame($expected, \html::quote($str)); @@ -132,6 +135,7 @@ class HtmlTest extends TestCase * * @dataProvider provide_parse_attrib_string_cases */ + #[DataProvider('provide_parse_attrib_string_cases')] public function test_parse_attrib_string($arg1, $expected) { $this->assertSame($expected, \html::parse_attrib_string($arg1)); diff --git a/tests/Framework/RcubeTest.php b/tests/Framework/RcubeTest.php index f857ea3ca..68d64a7e2 100644 --- a/tests/Framework/RcubeTest.php +++ b/tests/Framework/RcubeTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\RequiresFunction; use PHPUnit\Framework\TestCase; /** @@ -67,6 +68,7 @@ class RcubeTest extends TestCase * * @requires function shell_exec */ + #[RequiresFunction('shell_exec')] public function test_exec() { if (\PHP_OS_FAMILY === 'Windows') { diff --git a/tests/Framework/SpoofcheckerTest.php b/tests/Framework/SpoofcheckerTest.php index 4ba5d86cb..52c3b7e9f 100644 --- a/tests/Framework/SpoofcheckerTest.php +++ b/tests/Framework/SpoofcheckerTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -36,6 +37,7 @@ class SpoofcheckerTest extends TestCase /** * @dataProvider provide_check_cases */ + #[DataProvider('provide_check_cases')] public function test_check($email, $expected) { $this->assertSame($expected, \rcube_spoofchecker::check($email)); diff --git a/tests/Framework/StringReplacerTest.php b/tests/Framework/StringReplacerTest.php index 02950069d..c2b21e391 100644 --- a/tests/Framework/StringReplacerTest.php +++ b/tests/Framework/StringReplacerTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -56,6 +57,7 @@ class StringReplacerTest extends TestCase /** * @dataProvider provide_replace_cases */ + #[DataProvider('provide_replace_cases')] public function test_replace($input, $output) { $replacer = new \rcube_string_replacer(); diff --git a/tests/Framework/Text2HtmlTest.php b/tests/Framework/Text2HtmlTest.php index f36d5afb0..3d279e946 100644 --- a/tests/Framework/Text2HtmlTest.php +++ b/tests/Framework/Text2HtmlTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -114,6 +115,7 @@ class Text2HtmlTest extends TestCase * * @dataProvider provide_text2html_cases */ + #[DataProvider('provide_text2html_cases')] public function test_text2html($input, $output, $options) { $t2h = new \rcube_text2html($input, false, $options); diff --git a/tests/Framework/UtilsTest.php b/tests/Framework/UtilsTest.php index 8b8dc0a90..58b110ba9 100644 --- a/tests/Framework/UtilsTest.php +++ b/tests/Framework/UtilsTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Roundcube\Tests\StderrMock; @@ -99,6 +100,7 @@ class UtilsTest extends TestCase /** * @dataProvider provide_valid_email_cases */ + #[DataProvider('provide_valid_email_cases')] public function test_valid_email($email, $title) { $this->assertTrue(\rcube_utils::check_email($email, false), $title); @@ -107,6 +109,7 @@ class UtilsTest extends TestCase /** * @dataProvider provide_invalid_email_cases */ + #[DataProvider('provide_invalid_email_cases')] public function test_invalid_email($email, $title) { $this->assertFalse(\rcube_utils::check_email($email, false), $title); @@ -151,6 +154,7 @@ class UtilsTest extends TestCase /** * @dataProvider provide_valid_ip_cases */ + #[DataProvider('provide_valid_ip_cases')] public function test_valid_ip($ip) { $this->assertTrue(\rcube_utils::check_ip($ip)); @@ -159,6 +163,7 @@ class UtilsTest extends TestCase /** * @dataProvider provide_invalid_ip_cases */ + #[DataProvider('provide_invalid_ip_cases')] public function test_invalid_ip($ip) { $this->assertFalse(\rcube_utils::check_ip($ip)); @@ -187,6 +192,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_rep_specialchars_output_cases */ + #[DataProvider('provide_rep_specialchars_output_cases')] public function test_rep_specialchars_output($type, $mode, $str, $res) { $result = \rcube_utils::rep_specialchars_output( @@ -413,6 +419,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_explode_style_cases */ + #[DataProvider('provide_explode_style_cases')] public function test_explode_style($input, $output) { $this->assertSame($output, \rcube_utils::parse_css_block($input)); @@ -786,6 +793,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_idn_convert_cases */ + #[DataProvider('provide_idn_convert_cases')] public function test_idn_to_ascii($decoded, $encoded) { $this->assertSame(\rcube_utils::idn_to_ascii($decoded), $encoded); @@ -799,6 +807,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_idn_convert_cases */ + #[DataProvider('provide_idn_convert_cases')] public function test_idn_to_utf8($decoded, $encoded) { $this->assertSame(\rcube_utils::idn_to_utf8($encoded), $decoded); @@ -831,6 +840,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_parse_host_cases */ + #[DataProvider('provide_parse_host_cases')] public function test_parse_host($name, $host, $result) { $this->assertSame(\rcube_utils::parse_host($name, $host), $result); @@ -861,6 +871,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_parse_host_uri_cases */ + #[DataProvider('provide_parse_host_uri_cases')] public function test_parse_host_uri($args, $result) { $this->assertSame($result, call_user_func_array('rcube_utils::parse_host_uri', $args)); @@ -888,6 +899,7 @@ class UtilsTest extends TestCase * * @dataProvider provide_remove_subject_prefix_cases */ + #[DataProvider('provide_remove_subject_prefix_cases')] public function test_remove_subject_prefix($mode, $subject, $result) { $this->assertSame(\rcube_utils::remove_subject_prefix($subject, $mode), $result); diff --git a/tests/Framework/WashtmlTest.php b/tests/Framework/WashtmlTest.php index f01d9ee51..b1516f90d 100644 --- a/tests/Framework/WashtmlTest.php +++ b/tests/Framework/WashtmlTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Framework; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -487,6 +488,7 @@ class WashtmlTest extends TestCase * * @dataProvider provide_wash_svg_tests_cases */ + #[DataProvider('provide_wash_svg_tests_cases')] public function test_wash_svg_tests($input, $expected) { $washer = new \rcube_washtml(); @@ -553,6 +555,7 @@ class WashtmlTest extends TestCase * * @dataProvider provide_wash_xss_tests_cases */ + #[DataProvider('provide_wash_xss_tests_cases')] public function test_wash_xss_tests($input, $expected) { $washer = new \rcube_washtml(['allow_remote' => true, 'html_elements' => ['body']]); diff --git a/tests/Rcmail/InstallTest.php b/tests/Rcmail/InstallTest.php index 99188500e..e632b2ade 100644 --- a/tests/Rcmail/InstallTest.php +++ b/tests/Rcmail/InstallTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Rcmail; +use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily; use Roundcube\Tests\ActionTestCase; /** @@ -81,6 +82,7 @@ class InstallTest extends ActionTestCase * * @requires OSFAMILY Linux */ + #[RequiresOperatingSystemFamily('Linux')] public function test_check_mime_extensions() { $rcmail = \rcmail::get_instance(); diff --git a/tests/Rcmail/OutputHtmlTest.php b/tests/Rcmail/OutputHtmlTest.php index 0ed31313d..45c359b28 100644 --- a/tests/Rcmail/OutputHtmlTest.php +++ b/tests/Rcmail/OutputHtmlTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Rcmail; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** @@ -319,6 +320,7 @@ class OutputHtmlTest extends TestCase * * @dataProvider provide_conditions_cases */ + #[DataProvider('provide_conditions_cases')] public function test_conditions($input, $output) { $object = new \rcmail_output_html(); diff --git a/tests/Rcmail/SendmailTest.php b/tests/Rcmail/SendmailTest.php index 703612f52..d611a03e2 100644 --- a/tests/Rcmail/SendmailTest.php +++ b/tests/Rcmail/SendmailTest.php @@ -2,6 +2,7 @@ namespace Roundcube\Tests\Rcmail; +use PHPUnit\Framework\Attributes\DataProvider; use Roundcube\Tests\ActionTestCase; /** @@ -153,6 +154,7 @@ class SendmailTest extends ActionTestCase /** * @dataProvider provide_email_input_format_cases */ + #[DataProvider('provide_email_input_format_cases')] public function test_email_input_format($input, $output, $charset) { $sendmail = new \rcmail_sendmail();