self::$refDB->write(self::$testDatastore, PHPPREFIX, PHPSUFFIX);
$GLOBALS['config']['DATASTORE'] = self::$testDatastore;
- self::$publicLinkDB = new LinkDB(false);
- self::$privateLinkDB = new LinkDB(true);
+ self::$publicLinkDB = new LinkDB(false, false);
+ self::$privateLinkDB = new LinkDB(true, false);
}
/**
*/
public function testConstructLoggedIn()
{
- new LinkDB(true);
+ new LinkDB(true, false);
$this->assertFileExists(self::$testDatastore);
}
*/
public function testConstructLoggedOut()
{
- new LinkDB(false);
+ new LinkDB(false, false);
$this->assertFileExists(self::$testDatastore);
}
public function testConstructDatastoreNotWriteable()
{
$GLOBALS['config']['DATASTORE'] = 'null/store.db';
- new LinkDB(false);
+ new LinkDB(false, false);
}
/**
*/
public function testCheckDBNew()
{
- $linkDB = new LinkDB(false);
+ $linkDB = new LinkDB(false, false);
unlink(self::$testDatastore);
$this->assertFileNotExists(self::$testDatastore);
*/
public function testCheckDBLoad()
{
- $linkDB = new LinkDB(false);
+ $linkDB = new LinkDB(false, false);
$this->assertEquals(
self::$dummyDatastoreSHA1,
sha1_file(self::$testDatastore)
public function testReadEmptyDB()
{
file_put_contents(self::$testDatastore, PHPPREFIX.'S7QysKquBQA='.PHPSUFFIX);
- $emptyDB = new LinkDB(false);
+ $emptyDB = new LinkDB(false, false);
$this->assertEquals(0, sizeof($emptyDB));
$this->assertEquals(0, count($emptyDB));
}
*/
public function testSaveDB()
{
- $testDB = new LinkDB(true);
+ $testDB = new LinkDB(true, false);
$dbSize = sizeof($testDB);
$link = array(
$testDB->savedb();
- $testDB = new LinkDB(true);
+ $testDB = new LinkDB(true, false);
$this->assertEquals($dbSize + 1, sizeof($testDB));
}
);
}
+ /**
+ * Count existing links - public links hidden
+ */
+ public function testCountHiddenPublic()
+ {
+ $linkDB = new LinkDB(false, true);
+
+ $this->assertEquals(
+ 0,
+ $linkDB->count()
+ );
+ $this->assertEquals(
+ 0,
+ $linkDB->count()
+ );
+ }
+
/**
* List the days for which links have been posted
*/