diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-02-27 13:08:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 13:08:45 +0300 |
commit | 93aef4865cfdee9fcfa5acc9ff1950459a0af42e (patch) | |
tree | aa8ad643d8ad233ffb2b033a437bcd2b71274877 /plugins/LanguagesManager | |
parent | f28c7fa6cb6c63c8f459206448c7dcb93568099e (diff) |
Update to PHPUnit 8.5 (#15581)
* use latest phpunit/phpunit ~8.5
* submodule updates
* fixes
Diffstat (limited to 'plugins/LanguagesManager')
3 files changed, 15 insertions, 13 deletions
diff --git a/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php b/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php index ec0900c0e1..4a58eb9a67 100644 --- a/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php +++ b/plugins/LanguagesManager/tests/Integration/LanguagesManagerTest.php @@ -87,12 +87,13 @@ class LanguagesManagerTest extends \PHPUnit\Framework\TestCase $translations = $translationWriter->getTranslations($language); if (empty($translations)) { + self::assertTrue(true); return; // skip language / plugin combinations that aren't present } $translationWriter->setTranslations($translations); - $this->assertTrue($translationWriter->isValid(), $translationWriter->getValidationMessage()); + $this->assertTrue($translationWriter->isValid(), $translationWriter->getValidationMessage() ?: ''); if ($translationWriter->wasFiltered()) { @@ -116,11 +117,11 @@ class LanguagesManagerTest extends \PHPUnit\Framework\TestCase * test language when it's not defined * * @group Plugins - * - * @expectedException Exception */ function testWriterInvalidPlugin() { + $this->expectException(\Exception::class); + new Writer('de', 'iNvaLiDPluGin'); // invalid plugin throws exception } diff --git a/plugins/LanguagesManager/tests/Integration/ModelTest.php b/plugins/LanguagesManager/tests/Integration/ModelTest.php index fb0cc94456..975e92021e 100644 --- a/plugins/LanguagesManager/tests/Integration/ModelTest.php +++ b/plugins/LanguagesManager/tests/Integration/ModelTest.php @@ -26,7 +26,7 @@ class ModelTest extends IntegrationTestCase */ protected $model; - public function setUp() + public function setUp(): void { $this->model = new Model(); parent::setUp(); @@ -109,7 +109,7 @@ class ModelTest extends IntegrationTestCase $tableNames = $this->getCurrentAvailableTableNames(); foreach ($expectedTables as $expectedTable) { - $this->assertContains(Common::prefixTable($expectedTable), $tableNames); + self::assertTrue(in_array(Common::prefixTable($expectedTable), $tableNames)); } } @@ -118,7 +118,7 @@ class ModelTest extends IntegrationTestCase $tableNames = $this->getCurrentAvailableTableNames(); foreach ($expectedTables as $expectedTable) { - $this->assertNotContains(Common::prefixTable($expectedTable), $tableNames); + self::assertTrue(!in_array(Common::prefixTable($expectedTable), $tableNames)); } } diff --git a/plugins/LanguagesManager/tests/Unit/TranslationWriter/WriterTest.php b/plugins/LanguagesManager/tests/Unit/TranslationWriter/WriterTest.php index 62fe32f417..dc2189a426 100644 --- a/plugins/LanguagesManager/tests/Unit/TranslationWriter/WriterTest.php +++ b/plugins/LanguagesManager/tests/Unit/TranslationWriter/WriterTest.php @@ -44,11 +44,11 @@ class WriterTest extends \PHPUnit\Framework\TestCase /** * @group Core - * - * @expectedException \Exception */ public function testConstructorInvalid() { + $this->expectException(\Exception::class); + new Writer('en', 'InValIdPlUGin'); } @@ -115,22 +115,22 @@ class WriterTest extends \PHPUnit\Framework\TestCase /** * @group Core - * - * @expectedException \Exception */ public function testSaveException() { + $this->expectException(\Exception::class); + $writer = new Writer('it'); $writer->save(); } /** * @group Core - * - * @expectedException \Exception */ public function testSaveTemporaryException() { + $this->expectException(\Exception::class); + $writer = new Writer('it'); $writer->saveTemporary(); } @@ -241,11 +241,12 @@ class WriterTest extends \PHPUnit\Framework\TestCase /** * @group Core * - * @expectedException \Exception * @dataProvider getInvalidLanguages */ public function testSetLanguageInvalid($language) { + $this->expectException(\Exception::class); + $writer = new Writer('en', null); $writer->setLanguage($language); } |