From 598376d4cfeab52cb7aaefa0d553f74f603bad9b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 23 Jun 2015 20:54:43 +0200 Subject: [PATCH 1/2] Change fresh install default link Fixes #200 Let me know if you want to change anything in the description. --- application/LinkDB.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/application/LinkDB.php b/application/LinkDB.php index 2b3fb60b..ca619bba 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -179,11 +179,15 @@ private function checkDB() // Create a dummy database for example $this->links = array(); $link = array( - 'title'=>'Shaarli - sebsauvage.net', - 'url'=>'http://sebsauvage.net/wiki/doku.php?id=php:shaarli', - 'description'=>'Welcome to Shaarli! This is a bookmark. To edit or delete me, you must first login.', + 'title'=>' Shaarli: the personal, minimalist, super-fast, no-database delicious clone', + 'url'=>'https://github.com/shaarli/Shaarli/wiki', + 'description'=>'Welcome to Shaarli! This is your first public bookmark. To edit or delete me, you must first login. + +To learn how to use Shaarli, consult the link "Help/documentation" at the bottom of this page. + +You use the community supported version of the original Shaarli project, by Sebastien Sauvage.', 'private'=>0, - 'linkdate'=>'20110914_190000', + 'linkdate'=> date('Ymd_His'), 'tags'=>'opensource software' ); $this->links[$link['linkdate']] = $link; @@ -191,9 +195,9 @@ private function checkDB() $link = array( 'title'=>'My secret stuff... - Pastebin.com', 'url'=>'http://sebsauvage.net/paste/?8434b27936c09649#bR7XsXhoTiLcqCpQbmOpBi3rq2zzQUC5hBI7ZT1O3x8=', - 'description'=>'SShhhh!! I\'m a private link only YOU can see. You can delete me too.', + 'description'=>'Shhhh! I\'m a private link only YOU can see. You can delete me too.', 'private'=>1, - 'linkdate'=>'20110914_074522', + 'linkdate'=> date('Ymd_His', strtotime('-1 minute')), 'tags'=>'secretstuff' ); $this->links[$link['linkdate']] = $link; From 30e6f1ca2f4278f542cde625f8152c7be3551ed4 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 24 Jun 2015 11:47:36 +0200 Subject: [PATCH 2/2] Fixes unit tests: checking datastore filesize instead of hash. date() makes the hash validation worthless because it changes at every generation. --- tests/LinkDBTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index f67d4d9b..3b68dd20 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -18,7 +18,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase { // datastore to test write operations protected static $testDatastore = 'tests/datastore.php'; - protected static $dummyDatastoreSHA1 = 'e3edea8ea7bb50be4bcb404df53fbb4546a7156e'; + protected static $dummyDatastoreFilesize = 759; protected static $refDB = null; protected static $publicLinkDB = null; protected static $privateLinkDB = null; @@ -116,8 +116,8 @@ public function testCheckDBNew() // ensure the correct data has been written $this->assertEquals( - self::$dummyDatastoreSHA1, - sha1_file(self::$testDatastore) + self::$dummyDatastoreFilesize, + filesize(self::$testDatastore) ); } @@ -128,8 +128,8 @@ public function testCheckDBLoad() { $linkDB = new LinkDB(false, false); $this->assertEquals( - self::$dummyDatastoreSHA1, - sha1_file(self::$testDatastore) + self::$dummyDatastoreFilesize, + filesize(self::$testDatastore) ); $checkDB = self::getMethod('checkDB'); @@ -137,8 +137,8 @@ public function testCheckDBLoad() // ensure the datastore is left unmodified $this->assertEquals( - self::$dummyDatastoreSHA1, - sha1_file(self::$testDatastore) + self::$dummyDatastoreFilesize, + filesize(self::$testDatastore) ); }