]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LinkDBTest.php
LinkDB: update datastore method names
[github/shaarli/Shaarli.git] / tests / LinkDBTest.php
index e413928afa2bdddb5ef7b78c86059c9fb2f83615..9d79386c0b0b5a76aecdfe8825434722278290d4 100644 (file)
@@ -117,7 +117,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
         unlink(self::$testDatastore);
         $this->assertFileNotExists(self::$testDatastore);
 
-        $checkDB = self::getMethod('_checkDB');
+        $checkDB = self::getMethod('check');
         $checkDB->invokeArgs($linkDB, array());
         $this->assertFileExists(self::$testDatastore);
 
@@ -134,7 +134,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
         $datastoreSize = filesize(self::$testDatastore);
         $this->assertGreaterThan(0, $datastoreSize);
 
-        $checkDB = self::getMethod('_checkDB');
+        $checkDB = self::getMethod('check');
         $checkDB->invokeArgs($linkDB, array());
 
         // ensure the datastore is left unmodified
@@ -180,7 +180,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
     /**
      * Save the links to the DB
      */
-    public function testSaveDB()
+    public function testSave()
     {
         $testDB = new LinkDB(self::$testDatastore, true, false);
         $dbSize = sizeof($testDB);
@@ -194,7 +194,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
             'tags'=>'unit test'
         );
         $testDB[$link['linkdate']] = $link;
-        $testDB->savedb('tests');
+        $testDB->save('tests');
 
         $testDB = new LinkDB(self::$testDatastore, true, false);
         $this->assertEquals($dbSize + 1, sizeof($testDB));
@@ -317,6 +317,10 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
                 '-exclude' => 1,
                 '.hidden' => 1,
                 'hashtag' => 2,
+                'tag1' => 1,
+                'tag2' => 1,
+                'tag3' => 1,
+                'tag4' => 1,
             ),
             self::$privateLinkDB->allTags()
         );
@@ -429,30 +433,4 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
     {
         self::$publicLinkDB->filterHash('');
     }
-
-    /**
-     * test whitespace handling in tags.
-     * split on whitespace runs and don't allow empty tags.
-     */
-    public function testReadTagsWithWhitespace()
-    {
-        // test load contains "tags": " tag1  tag2   tag3  tag4   "
-        $ds  = '<?php /* ';
-        $ds .= 'fY5BDoMwDAS/gvwB4hRKMY9BEaASNQKUuL1U/L22D721Odheez';
-        $ds .= 'baQEjvQtgSeIdX12I/onfyYAjU6e1GkOL2mAMvMPxAC8mWIydD';
-        $ds .= 'enHsU0jrXlj1heCZk5k7gpX5oLr+ErUdkGBeypTjwXHfdOUItD';
-        $ds .= 'XycbgXHb24KxFYafWVtYvVRoQiQhw5vixrJDdY/LyENP5PcJ4f */ ?>';
-        file_put_contents(self::$testDatastore, $ds);
-        self::$publicLinkDB = new LinkDB(self::$testDatastore, false, false);
-
-        $this->assertEquals(
-            array(
-                'tag1' => 1,
-                'tag2' => 1,
-                'tag3' => 1,
-                'tag4' => 1
-            ),
-            self::$publicLinkDB->allTags()
-        );
-    }
 }