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/CustomJsTracker | |
parent | f28c7fa6cb6c63c8f459206448c7dcb93568099e (diff) |
Update to PHPUnit 8.5 (#15581)
* use latest phpunit/phpunit ~8.5
* submodule updates
* fixes
Diffstat (limited to 'plugins/CustomJsTracker')
4 files changed, 21 insertions, 26 deletions
diff --git a/plugins/CustomJsTracker/tests/Integration/ApiTest.php b/plugins/CustomJsTracker/tests/Integration/ApiTest.php index b8ffa36602..6bd2fc753e 100644 --- a/plugins/CustomJsTracker/tests/Integration/ApiTest.php +++ b/plugins/CustomJsTracker/tests/Integration/ApiTest.php @@ -26,7 +26,7 @@ class ApiTest extends IntegrationTestCase */ private $api; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -35,22 +35,20 @@ class ApiTest extends IntegrationTestCase $this->api = API::getInstance(); } - /** - * @expectedException \Piwik\NoAccessException - * @expectedExceptionMessage checkUserHasSomeAdminAccess - */ public function test_doesIncludePluginTrackersAutomatically_failsIfNotEnoughPermission() { + $this->expectException(\Piwik\NoAccessException::class); + $this->expectExceptionMessage('checkUserHasSomeAdminAccess'); + $this->setUser(); $this->api->doesIncludePluginTrackersAutomatically(); } - /** - * @expectedException \Piwik\NoAccessException - * @expectedExceptionMessage checkUserHasSomeAdminAccess - */ public function test_doesIncludePluginTrackersAutomatically_failsIfNotEnoughPermissionAnonymous() { + $this->expectException(\Piwik\NoAccessException::class); + $this->expectExceptionMessage('checkUserHasSomeAdminAccess'); + $this->setAnonymousUser(); $this->api->doesIncludePluginTrackersAutomatically(); } diff --git a/plugins/CustomJsTracker/tests/Integration/FileTest.php b/plugins/CustomJsTracker/tests/Integration/FileTest.php index 1457de0336..d64d5d413a 100644 --- a/plugins/CustomJsTracker/tests/Integration/FileTest.php +++ b/plugins/CustomJsTracker/tests/Integration/FileTest.php @@ -31,7 +31,7 @@ class FileTest extends IntegrationTestCase */ private $dir = ''; - public function setUp() + public function setUp(): void { parent::setUp(); $this->dir = PIWIK_DOCUMENT_ROOT . '/plugins/CustomJsTracker/tests/resources/'; @@ -44,7 +44,7 @@ class FileTest extends IntegrationTestCase } } - public function tearDown() + public function tearDown(): void { // restore permissions changed by makeNotWritableFile() chmod($this->dir, 0777); @@ -152,21 +152,19 @@ class FileTest extends IntegrationTestCase $this->assertTrue(true); } - /** - * @expectedException \Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException - * @expectedExceptionMessage not readable - */ public function test_checkReadable_shouldThrowException_IfNotIsReadable() { + $this->expectException(\Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException::class); + $this->expectExceptionMessage('not readable'); + $this->makeNotReadableFile()->checkReadable(); } - /** - * @expectedException \Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException - * @expectedExceptionMessage not writable - */ public function test_checkWritable_shouldThrowException_IfNotIsWritable() { + $this->expectException(\Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException::class); + $this->expectExceptionMessage('not writable'); + $this->makeNotReadableFile_inNonWritableDirectory()->checkWritable(); } diff --git a/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php b/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php index 0c0130e5b6..4977037c72 100644 --- a/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php +++ b/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php @@ -24,7 +24,7 @@ class TrackerUpdaterTest extends IntegrationTestCase private $dir; private $trackerJsChangedEventPath = null; - public function setUp() + public function setUp(): void { parent::setUp(); $this->dir = PIWIK_DOCUMENT_ROOT . '/plugins/CustomJsTracker/tests/resources/'; @@ -33,7 +33,7 @@ class TrackerUpdaterTest extends IntegrationTestCase $this->cleanUp(); } - public function tearDown() + public function tearDown(): void { parent::tearDown(); @@ -112,12 +112,11 @@ class TrackerUpdaterTest extends IntegrationTestCase $this->assertTrue(true); } - /** - * @expectedException \Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException - * @expectedExceptionMessage not writable - */ public function test_checkWillSucceed_shouldNotThrowExceptionIfTargetIsNotWritable() { + $this->expectException(\Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException::class); + $this->expectExceptionMessage('not writable'); + $updater = $this->makeUpdater(null, $this->dir . 'not-writable/MyNotExisIngFilessss.js'); $updater->checkWillSucceed(); } diff --git a/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php b/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php index 300c312984..26bbede5a8 100644 --- a/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php +++ b/plugins/CustomJsTracker/tests/System/PiwikJsContentTest.php @@ -33,7 +33,7 @@ class PiwikJsContentTest extends SystemTestCase $piwikMin = PIWIK_DOCUMENT_ROOT . '/js/piwik.min.js'; $content = file_get_contents($piwikMin); - $this->assertContains(PiwikJsManipulator::HOOK, $content); + self::assertStringContainsString(PiwikJsManipulator::HOOK, $content); } }
\ No newline at end of file |