aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2019-08-10 12:31:32 +0200
committerArthurHoaro <arthur@hoa.ro>2020-01-17 18:34:37 +0100
commitdef39d0dd7a81a4af9ad68b62c9e9823fbc2b38e (patch)
tree676b02604ae6f358ddb90c59c549465f6e9d6214 /tests
parentef028857531a6abe2d7180538b8510502ee2a467 (diff)
downloadShaarli-def39d0dd7a81a4af9ad68b62c9e9823fbc2b38e.tar.gz
Shaarli-def39d0dd7a81a4af9ad68b62c9e9823fbc2b38e.tar.zst
Shaarli-def39d0dd7a81a4af9ad68b62c9e9823fbc2b38e.zip
Run Unit Tests against PHP 7.4
Bump PHPUnit version and fix unit test - Globals are handled differently and are persistent through tests - Tests without assertions are marked as risky: some of them are just meant to check that no error is raised.
Diffstat (limited to 'tests')
-rw-r--r--tests/ApplicationUtilsTest.php10
-rw-r--r--tests/PluginManagerTest.php3
-rw-r--r--tests/api/ApiUtilsTest.php2
-rw-r--r--tests/config/ConfigPhpTest.php4
-rw-r--r--tests/feed/CachedPageTest.php1
-rw-r--r--tests/updater/UpdaterTest.php6
6 files changed, 18 insertions, 8 deletions
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php
index 82f8804d..15388970 100644
--- a/tests/ApplicationUtilsTest.php
+++ b/tests/ApplicationUtilsTest.php
@@ -253,9 +253,9 @@ class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase
253 public function testCheckSupportedPHPVersion() 253 public function testCheckSupportedPHPVersion()
254 { 254 {
255 $minVersion = '5.3'; 255 $minVersion = '5.3';
256 ApplicationUtils::checkPHPVersion($minVersion, '5.4.32'); 256 $this->assertTrue(ApplicationUtils::checkPHPVersion($minVersion, '5.4.32'));
257 ApplicationUtils::checkPHPVersion($minVersion, '5.5'); 257 $this->assertTrue(ApplicationUtils::checkPHPVersion($minVersion, '5.5'));
258 ApplicationUtils::checkPHPVersion($minVersion, '5.6.10'); 258 $this->assertTrue(ApplicationUtils::checkPHPVersion($minVersion, '5.6.10'));
259 } 259 }
260 260
261 /** 261 /**
@@ -265,7 +265,7 @@ class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase
265 */ 265 */
266 public function testCheckSupportedPHPVersion51() 266 public function testCheckSupportedPHPVersion51()
267 { 267 {
268 ApplicationUtils::checkPHPVersion('5.3', '5.1.0'); 268 $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.1.0'));
269 } 269 }
270 270
271 /** 271 /**
@@ -275,7 +275,7 @@ class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase
275 */ 275 */
276 public function testCheckSupportedPHPVersion52() 276 public function testCheckSupportedPHPVersion52()
277 { 277 {
278 ApplicationUtils::checkPHPVersion('5.3', '5.2'); 278 $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.2'));
279 } 279 }
280 280
281 /** 281 /**
diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php
index 71761ac1..195d959c 100644
--- a/tests/PluginManagerTest.php
+++ b/tests/PluginManagerTest.php
@@ -58,13 +58,12 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
58 58
59 /** 59 /**
60 * Test missing plugin loading. 60 * Test missing plugin loading.
61 *
62 * @return void
63 */ 61 */
64 public function testPluginNotFound() 62 public function testPluginNotFound()
65 { 63 {
66 $this->pluginManager->load(array()); 64 $this->pluginManager->load(array());
67 $this->pluginManager->load(array('nope', 'renope')); 65 $this->pluginManager->load(array('nope', 'renope'));
66 $this->addToAssertionCount(1);
68 } 67 }
69 68
70 /** 69 /**
diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php
index ea0ae500..7499dd71 100644
--- a/tests/api/ApiUtilsTest.php
+++ b/tests/api/ApiUtilsTest.php
@@ -60,7 +60,7 @@ class ApiUtilsTest extends \PHPUnit\Framework\TestCase
60 public function testValidateJwtTokenValid() 60 public function testValidateJwtTokenValid()
61 { 61 {
62 $secret = 'WarIsPeace'; 62 $secret = 'WarIsPeace';
63 ApiUtils::validateJwtToken(self::generateValidJwtToken($secret), $secret); 63 $this->assertTrue(ApiUtils::validateJwtToken(self::generateValidJwtToken($secret), $secret));
64 } 64 }
65 65
66 /** 66 /**
diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php
index 67d878ce..fb91b51b 100644
--- a/tests/config/ConfigPhpTest.php
+++ b/tests/config/ConfigPhpTest.php
@@ -3,6 +3,10 @@ namespace Shaarli\Config;
3 3
4/** 4/**
5 * Class ConfigPhpTest 5 * Class ConfigPhpTest
6 *
7 * We run tests in separate processes due to the usage for $GLOBALS
8 * which are kept between tests.
9 * @runTestsInSeparateProcesses
6 */ 10 */
7class ConfigPhpTest extends \PHPUnit\Framework\TestCase 11class ConfigPhpTest extends \PHPUnit\Framework\TestCase
8{ 12{
diff --git a/tests/feed/CachedPageTest.php b/tests/feed/CachedPageTest.php
index 0bcc1442..363028a2 100644
--- a/tests/feed/CachedPageTest.php
+++ b/tests/feed/CachedPageTest.php
@@ -44,6 +44,7 @@ class CachedPageTest extends \PHPUnit\Framework\TestCase
44 new CachedPage(self::$testCacheDir, '', false); 44 new CachedPage(self::$testCacheDir, '', false);
45 new CachedPage(self::$testCacheDir, 'http://shaar.li/?do=rss', true); 45 new CachedPage(self::$testCacheDir, 'http://shaar.li/?do=rss', true);
46 new CachedPage(self::$testCacheDir, 'http://shaar.li/?do=atom', false); 46 new CachedPage(self::$testCacheDir, 'http://shaar.li/?do=atom', false);
47 $this->addToAssertionCount(1);
47 } 48 }
48 49
49 /** 50 /**
diff --git a/tests/updater/UpdaterTest.php b/tests/updater/UpdaterTest.php
index 93bc86c1..ac87e33c 100644
--- a/tests/updater/UpdaterTest.php
+++ b/tests/updater/UpdaterTest.php
@@ -724,6 +724,9 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
724 */ 724 */
725 public function testUpdateMethodWebThumbnailerDisabled() 725 public function testUpdateMethodWebThumbnailerDisabled()
726 { 726 {
727 if (isset($_SESSION['warnings'])) {
728 unset($_SESSION['warnings']);
729 }
727 $this->conf->remove('thumbnails'); 730 $this->conf->remove('thumbnails');
728 $this->conf->set('thumbnail.enable_thumbnails', false); 731 $this->conf->set('thumbnail.enable_thumbnails', false);
729 $updater = new Updater([], [], $this->conf, true, $_SESSION); 732 $updater = new Updater([], [], $this->conf, true, $_SESSION);
@@ -740,6 +743,9 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
740 */ 743 */
741 public function testUpdateMethodWebThumbnailerNothingToDo() 744 public function testUpdateMethodWebThumbnailerNothingToDo()
742 { 745 {
746 if (isset($_SESSION['warnings'])) {
747 unset($_SESSION['warnings']);
748 }
743 $updater = new Updater([], [], $this->conf, true, $_SESSION); 749 $updater = new Updater([], [], $this->conf, true, $_SESSION);
744 $this->assertTrue($updater->updateMethodWebThumbnailer()); 750 $this->assertTrue($updater->updateMethodWebThumbnailer());
745 $this->assertFalse($this->conf->exists('thumbnail')); 751 $this->assertFalse($this->conf->exists('thumbnail'));