aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-03 12:59:16 +0200
committerGitHub <noreply@github.com>2020-10-03 12:59:16 +0200
commit7b18876361f2223672f3a2cac9fc0da16d12d69f (patch)
tree03a655c46d801d56211fb05cc2930824dace4565 /tests/bookmark
parentee07b7283faa197fc062ed85f4f96f98e8e77b03 (diff)
parentd246e2c5129fe8d3f8e1429b4e8ff8e3e486c779 (diff)
downloadShaarli-7b18876361f2223672f3a2cac9fc0da16d12d69f.tar.gz
Shaarli-7b18876361f2223672f3a2cac9fc0da16d12d69f.tar.zst
Shaarli-7b18876361f2223672f3a2cac9fc0da16d12d69f.zip
Merge pull request #1575 from ArthurHoaro/feature/php8
Diffstat (limited to 'tests/bookmark')
-rw-r--r--tests/bookmark/BookmarkArrayTest.php5
-rw-r--r--tests/bookmark/BookmarkFileServiceTest.php7
-rw-r--r--tests/bookmark/BookmarkFilterTest.php6
-rw-r--r--tests/bookmark/BookmarkInitializerTest.php2
-rw-r--r--tests/bookmark/BookmarkTest.php12
-rw-r--r--tests/bookmark/LinkUtilsTest.php22
6 files changed, 25 insertions, 29 deletions
diff --git a/tests/bookmark/BookmarkArrayTest.php b/tests/bookmark/BookmarkArrayTest.php
index bad3af8d..ebed9bfc 100644
--- a/tests/bookmark/BookmarkArrayTest.php
+++ b/tests/bookmark/BookmarkArrayTest.php
@@ -2,10 +2,7 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase; 5use Shaarli\TestCase;
6use Shaarli\Bookmark\Exception\InvalidBookmarkException;
7use Shaarli\Config\ConfigManager;
8use Shaarli\History;
9 6
10/** 7/**
11 * Class BookmarkArrayTest 8 * Class BookmarkArrayTest
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php
index 9cff0fb3..c399822b 100644
--- a/tests/bookmark/BookmarkFileServiceTest.php
+++ b/tests/bookmark/BookmarkFileServiceTest.php
@@ -6,7 +6,6 @@
6namespace Shaarli\Bookmark; 6namespace Shaarli\Bookmark;
7 7
8use DateTime; 8use DateTime;
9use PHPUnit\Framework\TestCase;
10use ReferenceLinkDB; 9use ReferenceLinkDB;
11use ReflectionClass; 10use ReflectionClass;
12use Shaarli; 11use Shaarli;
@@ -14,6 +13,7 @@ use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
14use Shaarli\Config\ConfigManager; 13use Shaarli\Config\ConfigManager;
15use Shaarli\Formatter\BookmarkMarkdownFormatter; 14use Shaarli\Formatter\BookmarkMarkdownFormatter;
16use Shaarli\History; 15use Shaarli\History;
16use Shaarli\TestCase;
17 17
18/** 18/**
19 * Unitary tests for LegacyLinkDBTest 19 * Unitary tests for LegacyLinkDBTest
@@ -637,11 +637,10 @@ class BookmarkFileServiceTest extends TestCase
637 */ 637 */
638 /** 638 /**
639 * Attempt to instantiate a LinkDB whereas the datastore is not writable 639 * Attempt to instantiate a LinkDB whereas the datastore is not writable
640 *
641 * @expectedException Shaarli\Bookmark\Exception\NotWritableDataStoreException
642 */ 640 */
643 public function testConstructDatastoreNotWriteable() 641 public function testConstructDatastoreNotWriteable()
644 { 642 {
643 $this->expectException(\Shaarli\Bookmark\Exception\NotWritableDataStoreException::class);
645 $this->expectExceptionMessageRegExp('#Couldn\'t load data from the data store file "null".*#'); 644 $this->expectExceptionMessageRegExp('#Couldn\'t load data from the data store file "null".*#');
646 645
647 $conf = new ConfigManager('tests/utils/config/configJson'); 646 $conf = new ConfigManager('tests/utils/config/configJson');
@@ -748,7 +747,7 @@ class BookmarkFileServiceTest extends TestCase
748 $link = $this->publicLinkDB->findByUrl('http://mediagoblin.org/'); 747 $link = $this->publicLinkDB->findByUrl('http://mediagoblin.org/');
749 748
750 $this->assertNotEquals(false, $link); 749 $this->assertNotEquals(false, $link);
751 $this->assertContains( 750 $this->assertContainsPolyfill(
752 'A free software media publishing platform', 751 'A free software media publishing platform',
753 $link->getDescription() 752 $link->getDescription()
754 ); 753 );
diff --git a/tests/bookmark/BookmarkFilterTest.php b/tests/bookmark/BookmarkFilterTest.php
index 752631a5..48c7f824 100644
--- a/tests/bookmark/BookmarkFilterTest.php
+++ b/tests/bookmark/BookmarkFilterTest.php
@@ -3,10 +3,10 @@
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use Exception; 5use Exception;
6use PHPUnit\Framework\TestCase;
7use ReferenceLinkDB; 6use ReferenceLinkDB;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\History; 8use Shaarli\History;
9use Shaarli\TestCase;
10 10
11/** 11/**
12 * Class BookmarkFilterTest. 12 * Class BookmarkFilterTest.
@@ -212,10 +212,10 @@ class BookmarkFilterTest extends TestCase
212 212
213 /** 213 /**
214 * Use an invalid date format 214 * Use an invalid date format
215 * @expectedException Exception
216 */ 215 */
217 public function testFilterInvalidDayWithChars() 216 public function testFilterInvalidDayWithChars()
218 { 217 {
218 $this->expectException(\Exception::class);
219 $this->expectExceptionMessageRegExp('/Invalid date format/'); 219 $this->expectExceptionMessageRegExp('/Invalid date format/');
220 220
221 self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away'); 221 self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away');
@@ -223,10 +223,10 @@ class BookmarkFilterTest extends TestCase
223 223
224 /** 224 /**
225 * Use an invalid date format 225 * Use an invalid date format
226 * @expectedException Exception
227 */ 226 */
228 public function testFilterInvalidDayDigits() 227 public function testFilterInvalidDayDigits()
229 { 228 {
229 $this->expectException(\Exception::class);
230 $this->expectExceptionMessageRegExp('/Invalid date format/'); 230 $this->expectExceptionMessageRegExp('/Invalid date format/');
231 231
232 self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20'); 232 self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20');
diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php
index 454269bb..25704004 100644
--- a/tests/bookmark/BookmarkInitializerTest.php
+++ b/tests/bookmark/BookmarkInitializerTest.php
@@ -2,9 +2,9 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Config\ConfigManager; 5use Shaarli\Config\ConfigManager;
7use Shaarli\History; 6use Shaarli\History;
7use Shaarli\TestCase;
8 8
9/** 9/**
10 * Class BookmarkInitializerTest 10 * Class BookmarkInitializerTest
diff --git a/tests/bookmark/BookmarkTest.php b/tests/bookmark/BookmarkTest.php
index 4b6a3c07..afec2440 100644
--- a/tests/bookmark/BookmarkTest.php
+++ b/tests/bookmark/BookmarkTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\Exception\InvalidBookmarkException; 5use Shaarli\Bookmark\Exception\InvalidBookmarkException;
6use Shaarli\TestCase;
7 7
8/** 8/**
9 * Class BookmarkTest 9 * Class BookmarkTest
@@ -150,7 +150,7 @@ class BookmarkTest extends TestCase
150 $exception = $e; 150 $exception = $e;
151 } 151 }
152 $this->assertNotNull($exception); 152 $this->assertNotNull($exception);
153 $this->assertContains('- ID: '. PHP_EOL, $exception->getMessage()); 153 $this->assertContainsPolyfill('- ID: '. PHP_EOL, $exception->getMessage());
154 } 154 }
155 155
156 /** 156 /**
@@ -169,7 +169,7 @@ class BookmarkTest extends TestCase
169 $exception = $e; 169 $exception = $e;
170 } 170 }
171 $this->assertNotNull($exception); 171 $this->assertNotNull($exception);
172 $this->assertContains('- ID: str'. PHP_EOL, $exception->getMessage()); 172 $this->assertContainsPolyfill('- ID: str'. PHP_EOL, $exception->getMessage());
173 } 173 }
174 174
175 /** 175 /**
@@ -188,7 +188,7 @@ class BookmarkTest extends TestCase
188 $exception = $e; 188 $exception = $e;
189 } 189 }
190 $this->assertNotNull($exception); 190 $this->assertNotNull($exception);
191 $this->assertContains('- ShortUrl: '. PHP_EOL, $exception->getMessage()); 191 $this->assertContainsPolyfill('- ShortUrl: '. PHP_EOL, $exception->getMessage());
192 } 192 }
193 193
194 /** 194 /**
@@ -207,7 +207,7 @@ class BookmarkTest extends TestCase
207 $exception = $e; 207 $exception = $e;
208 } 208 }
209 $this->assertNotNull($exception); 209 $this->assertNotNull($exception);
210 $this->assertContains('- Created: '. PHP_EOL, $exception->getMessage()); 210 $this->assertContainsPolyfill('- Created: '. PHP_EOL, $exception->getMessage());
211 } 211 }
212 212
213 /** 213 /**
@@ -226,7 +226,7 @@ class BookmarkTest extends TestCase
226 $exception = $e; 226 $exception = $e;
227 } 227 }
228 $this->assertNotNull($exception); 228 $this->assertNotNull($exception);
229 $this->assertContains('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage()); 229 $this->assertContainsPolyfill('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage());
230 } 230 }
231 231
232 /** 232 /**
diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php
index 0d07897b..ef00b92f 100644
--- a/tests/bookmark/LinkUtilsTest.php
+++ b/tests/bookmark/LinkUtilsTest.php
@@ -2,7 +2,7 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase; 5use Shaarli\TestCase;
6 6
7require_once 'tests/utils/CurlUtils.php'; 7require_once 'tests/utils/CurlUtils.php';
8 8
@@ -450,13 +450,13 @@ class LinkUtilsTest extends TestCase
450 カタカナ #カタカナ」カタカナ\n'; 450 カタカナ #カタカナ」カタカナ\n';
451 $autolinkedDescription = hashtag_autolink($rawDescription, $index); 451 $autolinkedDescription = hashtag_autolink($rawDescription, $index);
452 452
453 $this->assertContains($this->getHashtagLink('hashtag', $index), $autolinkedDescription); 453 $this->assertContainsPolyfill($this->getHashtagLink('hashtag', $index), $autolinkedDescription);
454 $this->assertNotContains(' #hashtag', $autolinkedDescription); 454 $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription);
455 $this->assertNotContains('>#nothashtag', $autolinkedDescription); 455 $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription);
456 $this->assertContains($this->getHashtagLink('ашок', $index), $autolinkedDescription); 456 $this->assertContainsPolyfill($this->getHashtagLink('ашок', $index), $autolinkedDescription);
457 $this->assertContains($this->getHashtagLink('カタカナ', $index), $autolinkedDescription); 457 $this->assertContainsPolyfill($this->getHashtagLink('カタカナ', $index), $autolinkedDescription);
458 $this->assertContains($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription); 458 $this->assertContainsPolyfill($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription);
459 $this->assertNotContains($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription); 459 $this->assertNotContainsPolyfill($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription);
460 } 460 }
461 461
462 /** 462 /**
@@ -467,9 +467,9 @@ class LinkUtilsTest extends TestCase
467 $rawDescription = 'blabla #hashtag x#nothashtag'; 467 $rawDescription = 'blabla #hashtag x#nothashtag';
468 $autolinkedDescription = hashtag_autolink($rawDescription); 468 $autolinkedDescription = hashtag_autolink($rawDescription);
469 469
470 $this->assertContains($this->getHashtagLink('hashtag'), $autolinkedDescription); 470 $this->assertContainsPolyfill($this->getHashtagLink('hashtag'), $autolinkedDescription);
471 $this->assertNotContains(' #hashtag', $autolinkedDescription); 471 $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription);
472 $this->assertNotContains('>#nothashtag', $autolinkedDescription); 472 $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription);
473 } 473 }
474 474
475 /** 475 /**