aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'tests/legacy')
-rw-r--r--tests/legacy/LegacyControllerTest.php2
-rw-r--r--tests/legacy/LegacyLinkDBTest.php15
-rw-r--r--tests/legacy/LegacyLinkFilterTest.php6
-rw-r--r--tests/legacy/LegacyUpdaterTest.php10
4 files changed, 15 insertions, 18 deletions
diff --git a/tests/legacy/LegacyControllerTest.php b/tests/legacy/LegacyControllerTest.php
index 4e52f3e1..1a2549a3 100644
--- a/tests/legacy/LegacyControllerTest.php
+++ b/tests/legacy/LegacyControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Legacy; 5namespace Shaarli\Legacy;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper; 7use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
diff --git a/tests/legacy/LegacyLinkDBTest.php b/tests/legacy/LegacyLinkDBTest.php
index 819bc272..df2cad62 100644
--- a/tests/legacy/LegacyLinkDBTest.php
+++ b/tests/legacy/LegacyLinkDBTest.php
@@ -18,7 +18,7 @@ require_once 'tests/utils/ReferenceLinkDB.php';
18/** 18/**
19 * Unitary tests for LegacyLinkDBTest 19 * Unitary tests for LegacyLinkDBTest
20 */ 20 */
21class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase 21class LegacyLinkDBTest extends \Shaarli\TestCase
22{ 22{
23 // datastore to test write operations 23 // datastore to test write operations
24 protected static $testDatastore = 'sandbox/datastore.php'; 24 protected static $testDatastore = 'sandbox/datastore.php';
@@ -99,11 +99,10 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
99 99
100 /** 100 /**
101 * Attempt to instantiate a LinkDB whereas the datastore is not writable 101 * Attempt to instantiate a LinkDB whereas the datastore is not writable
102 *
103 * @expectedException Shaarli\Exceptions\IOException
104 */ 102 */
105 public function testConstructDatastoreNotWriteable() 103 public function testConstructDatastoreNotWriteable()
106 { 104 {
105 $this->expectException(\Shaarli\Exceptions\IOException::class);
107 $this->expectExceptionMessageRegExp('/Error accessing "null"/'); 106 $this->expectExceptionMessageRegExp('/Error accessing "null"/');
108 107
109 new LegacyLinkDB('null/store.db', false, false); 108 new LegacyLinkDB('null/store.db', false, false);
@@ -258,7 +257,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
258 $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); 257 $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/');
259 258
260 $this->assertNotEquals(false, $link); 259 $this->assertNotEquals(false, $link);
261 $this->assertContains( 260 $this->assertContainsPolyfill(
262 'A free software media publishing platform', 261 'A free software media publishing platform',
263 $link['description'] 262 $link['description']
264 ); 263 );
@@ -471,9 +470,9 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
471 470
472 $res = $linkDB->renameTag('cartoon', 'Taz'); 471 $res = $linkDB->renameTag('cartoon', 'Taz');
473 $this->assertEquals(3, count($res)); 472 $this->assertEquals(3, count($res));
474 $this->assertContains(' Taz ', $linkDB[4]['tags']); 473 $this->assertContainsPolyfill(' Taz ', $linkDB[4]['tags']);
475 $this->assertContains(' Taz ', $linkDB[1]['tags']); 474 $this->assertContainsPolyfill(' Taz ', $linkDB[1]['tags']);
476 $this->assertContains(' Taz ', $linkDB[0]['tags']); 475 $this->assertContainsPolyfill(' Taz ', $linkDB[0]['tags']);
477 } 476 }
478 477
479 /** 478 /**
@@ -513,7 +512,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
513 512
514 $res = $linkDB->renameTag('cartoon', null); 513 $res = $linkDB->renameTag('cartoon', null);
515 $this->assertEquals(3, count($res)); 514 $this->assertEquals(3, count($res));
516 $this->assertNotContains('cartoon', $linkDB[4]['tags']); 515 $this->assertNotContainsPolyfill('cartoon', $linkDB[4]['tags']);
517 } 516 }
518 517
519 /** 518 /**
diff --git a/tests/legacy/LegacyLinkFilterTest.php b/tests/legacy/LegacyLinkFilterTest.php
index 9db921a9..45d7754d 100644
--- a/tests/legacy/LegacyLinkFilterTest.php
+++ b/tests/legacy/LegacyLinkFilterTest.php
@@ -10,7 +10,7 @@ use Shaarli\Legacy\LegacyLinkFilter;
10/** 10/**
11 * Class LegacyLinkFilterTest. 11 * Class LegacyLinkFilterTest.
12 */ 12 */
13class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase 13class LegacyLinkFilterTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * @var string Test datastore path. 16 * @var string Test datastore path.
@@ -197,10 +197,10 @@ class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase
197 197
198 /** 198 /**
199 * Use an invalid date format 199 * Use an invalid date format
200 * @expectedException Exception
201 */ 200 */
202 public function testFilterInvalidDayWithChars() 201 public function testFilterInvalidDayWithChars()
203 { 202 {
203 $this->expectException(\Exception::class);
204 $this->expectExceptionMessageRegExp('/Invalid date format/'); 204 $this->expectExceptionMessageRegExp('/Invalid date format/');
205 205
206 self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, 'Rainy day, dream away'); 206 self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, 'Rainy day, dream away');
@@ -208,10 +208,10 @@ class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase
208 208
209 /** 209 /**
210 * Use an invalid date format 210 * Use an invalid date format
211 * @expectedException Exception
212 */ 211 */
213 public function testFilterInvalidDayDigits() 212 public function testFilterInvalidDayDigits()
214 { 213 {
214 $this->expectException(\Exception::class);
215 $this->expectExceptionMessageRegExp('/Invalid date format/'); 215 $this->expectExceptionMessageRegExp('/Invalid date format/');
216 216
217 self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, '20'); 217 self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, '20');
diff --git a/tests/legacy/LegacyUpdaterTest.php b/tests/legacy/LegacyUpdaterTest.php
index acfac530..f7391b86 100644
--- a/tests/legacy/LegacyUpdaterTest.php
+++ b/tests/legacy/LegacyUpdaterTest.php
@@ -20,7 +20,7 @@ require_once 'inc/rain.tpl.class.php';
20 * Class UpdaterTest. 20 * Class UpdaterTest.
21 * Runs unit tests against the updater class. 21 * Runs unit tests against the updater class.
22 */ 22 */
23class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase 23class LegacyUpdaterTest extends \Shaarli\TestCase
24{ 24{
25 /** 25 /**
26 * @var string Path to test datastore. 26 * @var string Path to test datastore.
@@ -80,11 +80,10 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase
80 80
81 /** 81 /**
82 * Test errors in UpdaterUtils::write_updates_file(): empty updates file. 82 * Test errors in UpdaterUtils::write_updates_file(): empty updates file.
83 *
84 * @expectedException Exception
85 */ 83 */
86 public function testWriteEmptyUpdatesFile() 84 public function testWriteEmptyUpdatesFile()
87 { 85 {
86 $this->expectException(\Exception::class);
88 $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); 87 $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/');
89 88
90 UpdaterUtils::write_updates_file('', array('test')); 89 UpdaterUtils::write_updates_file('', array('test'));
@@ -92,11 +91,10 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase
92 91
93 /** 92 /**
94 * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. 93 * Test errors in UpdaterUtils::write_updates_file(): not writable updates file.
95 *
96 * @expectedException Exception
97 */ 94 */
98 public function testWriteUpdatesFileNotWritable() 95 public function testWriteUpdatesFileNotWritable()
99 { 96 {
97 $this->expectException(\Exception::class);
100 $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); 98 $this->expectExceptionMessageRegExp('/Unable to write(.*)/');
101 99
102 $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; 100 $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';
@@ -725,7 +723,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
725 $this->assertEquals(\Shaarli\Thumbnailer::MODE_ALL, $this->conf->get('thumbnails.mode')); 723 $this->assertEquals(\Shaarli\Thumbnailer::MODE_ALL, $this->conf->get('thumbnails.mode'));
726 $this->assertEquals(125, $this->conf->get('thumbnails.width')); 724 $this->assertEquals(125, $this->conf->get('thumbnails.width'));
727 $this->assertEquals(90, $this->conf->get('thumbnails.height')); 725 $this->assertEquals(90, $this->conf->get('thumbnails.height'));
728 $this->assertContains('You have enabled or changed thumbnails', $_SESSION['warnings'][0]); 726 $this->assertContainsPolyfill('You have enabled or changed thumbnails', $_SESSION['warnings'][0]);
729 } 727 }
730 728
731 /** 729 /**