tab 2 spaces in test files

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@419 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
cweiske 2009-10-25 19:35:48 +00:00
parent f0ec32d89b
commit 1bffdc3696
6 changed files with 740 additions and 740 deletions

View file

@ -30,15 +30,15 @@ class AllTests extends PHPUnit_Framework_TestSuite
public static function suite() public static function suite()
{ {
$suite = new AllTests(); $suite = new AllTests();
$tdir = dirname(__FILE__); $tdir = dirname(__FILE__);
$suite->addTestFile($tdir . '/BookmarkTest.php'); $suite->addTestFile($tdir . '/BookmarkTest.php');
$suite->addTestFile($tdir . '/Tag2TagTest.php'); $suite->addTestFile($tdir . '/Tag2TagTest.php');
$suite->addTestFile($tdir . '/TagsCacheTest.php'); $suite->addTestFile($tdir . '/TagsCacheTest.php');
$suite->addTestFile($tdir . '/CommonDescriptionTest.php'); $suite->addTestFile($tdir . '/CommonDescriptionTest.php');
$suite->addTestFile($tdir . '/SearchHistoryTest.php'); $suite->addTestFile($tdir . '/SearchHistoryTest.php');
$suite->addTestFile($tdir . '/TagTest.php'); $suite->addTestFile($tdir . '/TagTest.php');
$suite->addTestFile($tdir . '/VoteTest.php'); $suite->addTestFile($tdir . '/VoteTest.php');
return $suite; return $suite;
} }

View file

@ -68,58 +68,58 @@ class CommonDescriptionTest extends TestBase
public function testModifyDescription() public function testModifyDescription()
{ {
$cds = $this->cds; $cds = $this->cds;
$uId1 = 1; $uId1 = 1;
$uId2 = 2; $uId2 = 2;
$title1 = "title1"; $title1 = "title1";
$title2 = "title2"; $title2 = "title2";
$desc1 = "\"'(-è_çà)=´~#'#{{[\\\\[||`\^\^@^@}¹²¡×¿ ?./§µ%"; $desc1 = "\"'(-è_çà)=´~#'#{{[\\\\[||`\^\^@^@}¹²¡×¿ ?./§µ%";
$desc2 = "æâ€êþÿûîîôôöŀï'üð’‘ßä«≤»©»  ↓¿×÷¡¹²³"; $desc2 = "æâ€êþÿûîîôôöŀï'üð’‘ßä«≤»©»  ↓¿×÷¡¹²³";
$time1 = time(); $time1 = time();
$time2 = time()+200; $time2 = time()+200;
$tagDesc1 = array('cdId'=>1, 'tag'=>'taghouse', 'cdDescription'=>$desc1, 'uId'=>$uId1,'cdDatetime'=>$time1); $tagDesc1 = array('cdId'=>1, 'tag'=>'taghouse', 'cdDescription'=>$desc1, 'uId'=>$uId1,'cdDatetime'=>$time1);
$tagDesc2 = array('cdId'=>2, 'tag'=>'taghouse', 'cdDescription'=>$desc2, 'uId'=>$uId2,'cdDatetime'=>$time2); $tagDesc2 = array('cdId'=>2, 'tag'=>'taghouse', 'cdDescription'=>$desc2, 'uId'=>$uId2,'cdDatetime'=>$time2);
$cds->addTagDescription('taghouse', $desc1, $uId1, $time1); $cds->addTagDescription('taghouse', $desc1, $uId1, $time1);
$cds->addTagDescription('taghouse', $desc2, $uId2, $time2); $cds->addTagDescription('taghouse', $desc2, $uId2, $time2);
$desc = $cds->getLastTagDescription('taghouse'); $desc = $cds->getLastTagDescription('taghouse');
$this->assertContains('taghouse', $desc); $this->assertContains('taghouse', $desc);
$this->assertContains($desc2, $desc); $this->assertContains($desc2, $desc);
$this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc); $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc);
$desc = $cds->getAllTagsDescription('taghouse'); $desc = $cds->getAllTagsDescription('taghouse');
$this->assertContains($desc1, $desc[1]); $this->assertContains($desc1, $desc[1]);
$this->assertContains(gmdate('Y-m-d H:i:s', $time1), $desc[1]); $this->assertContains(gmdate('Y-m-d H:i:s', $time1), $desc[1]);
$this->assertContains($desc2, $desc[0]); $this->assertContains($desc2, $desc[0]);
$this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc[0]); $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc[0]);
$desc = $cds->getDescriptionById(1); $desc = $cds->getDescriptionById(1);
$this->assertContains($desc1, $desc); $this->assertContains($desc1, $desc);
$bkDesc1 = array('cdId'=>3, 'bHash'=>'10', 'cdTitle'=>$title1, 'cdDescription'=>$desc1, 'uId'=>$uId1,'cdDatetime'=>$time1); $bkDesc1 = array('cdId'=>3, 'bHash'=>'10', 'cdTitle'=>$title1, 'cdDescription'=>$desc1, 'uId'=>$uId1,'cdDatetime'=>$time1);
$bkDesc2 = array('cdId'=>4, 'bHash'=>'10', 'cdTitle'=>$title2, 'cdDescription'=>$desc2, 'uId'=>$uId2,'cdDatetime'=>$time2); $bkDesc2 = array('cdId'=>4, 'bHash'=>'10', 'cdTitle'=>$title2, 'cdDescription'=>$desc2, 'uId'=>$uId2,'cdDatetime'=>$time2);
$cds->addBookmarkDescription(10, $title1, $desc1, $uId1, $time1); $cds->addBookmarkDescription(10, $title1, $desc1, $uId1, $time1);
$cds->addBookmarkDescription(10, $title2, $desc2, $uId2, $time2); $cds->addBookmarkDescription(10, $title2, $desc2, $uId2, $time2);
$desc = $cds->getLastBookmarkDescription(10); $desc = $cds->getLastBookmarkDescription(10);
$this->assertContains($title2, $desc); $this->assertContains($title2, $desc);
$this->assertContains($desc2, $desc); $this->assertContains($desc2, $desc);
$this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc); $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc);
$desc = $cds->getAllBookmarksDescription(10); $desc = $cds->getAllBookmarksDescription(10);
$this->assertContains($title1, $desc[1]); $this->assertContains($title1, $desc[1]);
$this->assertContains($desc1, $desc[1]); $this->assertContains($desc1, $desc[1]);
$this->assertContains(gmdate('Y-m-d H:i:s', $time1), $desc[1]); $this->assertContains(gmdate('Y-m-d H:i:s', $time1), $desc[1]);
$this->assertContains($title2, $desc[0]); $this->assertContains($title2, $desc[0]);
$this->assertContains($desc2, $desc[0]); $this->assertContains($desc2, $desc[0]);
$this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc[0]); $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc[0]);
$desc = $cds->getDescriptionById(3); $desc = $cds->getDescriptionById(3);
$this->assertContains($desc1, $desc); $this->assertContains($desc1, $desc);
} }

View file

@ -53,61 +53,61 @@ class SearchHistoryTest extends TestBase
protected function setUp() protected function setUp()
{ {
$this->us =SemanticScuttle_Service_Factory::get('User'); $this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll(); $this->bs->deleteAll();
$this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$this->b2ts->deleteAll(); $this->b2ts->deleteAll();
$this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag'); $this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag');
$this->tts->deleteAll(); $this->tts->deleteAll();
$this->tsts =SemanticScuttle_Service_Factory::get('TagStat'); $this->tsts =SemanticScuttle_Service_Factory::get('TagStat');
$this->tsts->deleteAll(); $this->tsts->deleteAll();
$this->shs =SemanticScuttle_Service_Factory::get('SearchHistory'); $this->shs =SemanticScuttle_Service_Factory::get('SearchHistory');
$this->shs->deleteAll(); $this->shs->deleteAll();
} }
public function testSearchHistory() public function testSearchHistory()
{ {
$shs = $this->shs; $shs = $this->shs;
$terms = 'bbqsdkbb;,:,:q;,qddds&é"\'\\\\\(-è_çà)'; $terms = 'bbqsdkbb;,:,:q;,qddds&é"\'\\\\\(-è_çà)';
$terms2 = '~#{|`]'; $terms2 = '~#{|`]';
$range = 'all'; $range = 'all';
$nbResults = 10908; $nbResults = 10908;
$uId = 10; $uId = 10;
$shs->addSearch($terms, $range, $nbResults, $uId); $shs->addSearch($terms, $range, $nbResults, $uId);
$shs->addSearch($terms2, $range, $nbResults, $uId); $shs->addSearch($terms2, $range, $nbResults, $uId);
$shs->addSearch('', $range, $nbResults, $uId); // A void search must not be saved $shs->addSearch('', $range, $nbResults, $uId); // A void search must not be saved
$searches = $shs->getAllSearches(); $searches = $shs->getAllSearches();
$this->assertSame(2, count($searches)); $this->assertSame(2, count($searches));
$searches = $shs->getAllSearches($range, $uId); $searches = $shs->getAllSearches($range, $uId);
$this->assertEquals(2, count($searches)); $this->assertEquals(2, count($searches));
$searches = $shs->getAllSearches($range, 20); // fake userid $searches = $shs->getAllSearches($range, 20); // fake userid
$this->assertEquals(0, count($searches)); $this->assertEquals(0, count($searches));
$searches = $shs->getAllSearches($range, $uId, 1); $searches = $shs->getAllSearches($range, $uId, 1);
$this->assertEquals(1, count($searches)); $this->assertEquals(1, count($searches));
$searches = $shs->getAllSearches($range, null, 1, 1); $searches = $shs->getAllSearches($range, null, 1, 1);
$this->assertEquals(1, count($searches)); $this->assertEquals(1, count($searches));
//test content of results //test content of results
$searches = $shs->getAllSearches(); $searches = $shs->getAllSearches();
$this->assertSame($terms2, $searches[0]['shTerms']); $this->assertSame($terms2, $searches[0]['shTerms']);
$this->assertSame($range, $searches[0]['shRange']); $this->assertSame($range, $searches[0]['shRange']);
$this->assertEquals($nbResults, $searches[0]['shNbResults']); $this->assertEquals($nbResults, $searches[0]['shNbResults']);
$this->assertEquals($uId, $searches[0]['uId']); $this->assertEquals($uId, $searches[0]['uId']);
$this->assertSame($terms, $searches[1]['shTerms']); $this->assertSame($terms, $searches[1]['shTerms']);
$this->assertSame($range, $searches[1]['shRange']); $this->assertSame($range, $searches[1]['shRange']);
$this->assertEquals($nbResults, $searches[1]['shNbResults']); $this->assertEquals($nbResults, $searches[1]['shNbResults']);
$this->assertEquals($uId, $searches[1]['uId']); $this->assertEquals($uId, $searches[1]['uId']);
//test distinct parameter //test distinct parameter
$shs->addSearch($terms, $range, $nbResults, 30); // we repeat a search (same terms) $shs->addSearch($terms, $range, $nbResults, 30); // we repeat a search (same terms)
$searches = $shs->getAllSearches(); $searches = $shs->getAllSearches();
$this->assertSame(3, count($searches)); $this->assertSame(3, count($searches));
$searches = $shs->getAllSearches(NULL, NULL, NULL, NULL, true); $searches = $shs->getAllSearches(NULL, NULL, NULL, NULL, true);
$this->assertSame(2, count($searches)); $this->assertSame(2, count($searches));
} }
} }

View file

@ -28,10 +28,10 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
*/ */
class Tag2TagTest extends TestBase class Tag2TagTest extends TestBase
{ {
protected $us; protected $us;
protected $bs; protected $bs;
protected $b2ts; protected $b2ts;
protected $tts; protected $tts;
@ -50,487 +50,487 @@ class Tag2TagTest extends TestBase
protected function setUp() protected function setUp()
{ {
$this->us =SemanticScuttle_Service_Factory::get('User'); $this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll(); $this->bs->deleteAll();
$this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$this->b2ts->deleteAll(); $this->b2ts->deleteAll();
$this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag'); $this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag');
$this->tts->deleteAll(); $this->tts->deleteAll();
$this->tsts =SemanticScuttle_Service_Factory::get('TagStat'); $this->tsts =SemanticScuttle_Service_Factory::get('TagStat');
$this->tsts->deleteAll(); $this->tsts->deleteAll();
} }
public function testManipulateTag2TagRelationsOfInclusion() public function testManipulateTag2TagRelationsOfInclusion()
{ {
$tts = $this->tts; $tts = $this->tts;
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('a', 'c', '>', 1); $tts->addLinkedTags('a', 'c', '>', 1);
$tts->addLinkedTags('a', 'd', '>', 20); $tts->addLinkedTags('a', 'd', '>', 20);
$tts->addLinkedTags('b', 'd', '>', 1); $tts->addLinkedTags('b', 'd', '>', 1);
$tts->addLinkedTags('d', 'e', '>', 1); $tts->addLinkedTags('d', 'e', '>', 1);
$tts->addLinkedTags('d', 'e', '>', 20); $tts->addLinkedTags('d', 'e', '>', 20);
$tts->addLinkedTags('f', 'g', '>', 20); $tts->addLinkedTags('f', 'g', '>', 20);
// basic test // basic test
$links = $tts->getLinks(1); $links = $tts->getLinks(1);
$this->assertEquals(4, count($links)); $this->assertEquals(4, count($links));
$allLinkedTags = $tts->getAllLinkedTags('e', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('e', '>', 1);
$this->assertEquals(array(), $allLinkedTags); $this->assertEquals(array(), $allLinkedTags);
$allLinkedTags = $tts->getAllLinkedTags('d', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('d', '>', 1);
$this->assertEquals(array('e'), $allLinkedTags); $this->assertEquals(array('e'), $allLinkedTags);
$allLinkedTags = $tts->getAllLinkedTags('b', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('b', '>', 1);
$this->assertEquals(array('d', 'e'), $allLinkedTags); $this->assertEquals(array('d', 'e'), $allLinkedTags);
$this->assertEquals(2, sizeof($allLinkedTags)); $this->assertEquals(2, sizeof($allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$allLinkedTags = $tts->getAllLinkedTags('a', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('a', '>', 1);
$this->assertEquals(4, sizeof($allLinkedTags)); $this->assertEquals(4, sizeof($allLinkedTags));
$this->assertTrue(in_array('b', $allLinkedTags)); $this->assertTrue(in_array('b', $allLinkedTags));
$this->assertTrue(in_array('c', $allLinkedTags)); $this->assertTrue(in_array('c', $allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
// warning: we add recursive link // warning: we add recursive link
$tts->addLinkedTags('b', 'a', '>', 1); $tts->addLinkedTags('b', 'a', '>', 1);
$allLinkedTags = $tts->getAllLinkedTags('a', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('a', '>', 1);
$this->assertEquals(4, sizeof($allLinkedTags)); $this->assertEquals(4, sizeof($allLinkedTags));
//$this->assertTrue(in_array('a', $allLinkedTags)); //$this->assertTrue(in_array('a', $allLinkedTags));
$this->assertTrue(in_array('b', $allLinkedTags)); $this->assertTrue(in_array('b', $allLinkedTags));
$this->assertTrue(in_array('c', $allLinkedTags)); $this->assertTrue(in_array('c', $allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$orphewTags = $tts->getOrphewTags('>', 1); $orphewTags = $tts->getOrphewTags('>', 1);
$this->assertEquals(0, sizeof($orphewTags)); $this->assertEquals(0, sizeof($orphewTags));
$orphewTags = $tts->getOrphewTags('>', 20); $orphewTags = $tts->getOrphewTags('>', 20);
$this->assertEquals(2, sizeof($orphewTags)); $this->assertEquals(2, sizeof($orphewTags));
$this->assertSame('a', $orphewTags[0]['tag']); $this->assertSame('a', $orphewTags[0]['tag']);
$this->assertSame('f', $orphewTags[1]['tag']); $this->assertSame('f', $orphewTags[1]['tag']);
$orphewTags = $tts->getOrphewTags('>'); $orphewTags = $tts->getOrphewTags('>');
$this->assertEquals(1, sizeof($orphewTags)); $this->assertEquals(1, sizeof($orphewTags));
$this->assertSame('f', $orphewTags[0]['tag']); $this->assertSame('f', $orphewTags[0]['tag']);
$linkedTags = $tts->getLinkedTags('a', '>'); $linkedTags = $tts->getLinkedTags('a', '>');
$this->assertSame(array('b', 'c', 'd'), $linkedTags); $this->assertSame(array('b', 'c', 'd'), $linkedTags);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertSame(array('b', 'c'), $linkedTags); $this->assertSame(array('b', 'c'), $linkedTags);
$tts->removeLinkedTags('a', 'b', '>', 1); $tts->removeLinkedTags('a', 'b', '>', 1);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertSame(array('c'), $linkedTags); $this->assertSame(array('c'), $linkedTags);
$tts->removeLinkedTags('a', 'c', '>', 1); $tts->removeLinkedTags('a', 'c', '>', 1);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertEquals(0, sizeof($linkedTags)); $this->assertEquals(0, sizeof($linkedTags));
} }
public function testManipulateTag2TagRelationsOfSynonym() public function testManipulateTag2TagRelationsOfSynonym()
{ {
$tts = $this->tts; $tts = $this->tts;
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'c', '>', 1); $tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('b', 'd', '=', 1); $tts->addLinkedTags('b', 'd', '=', 1);
$tts->addLinkedTags('d', 'e', '=', 1); $tts->addLinkedTags('d', 'e', '=', 1);
$tts->addLinkedTags('d', 'f', '=', 1); $tts->addLinkedTags('d', 'f', '=', 1);
$tts->addLinkedTags('e', 'g', '>', 1); $tts->addLinkedTags('e', 'g', '>', 1);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertSame(array('b'), $linkedTags); $this->assertSame(array('b'), $linkedTags);
$linkedTags = $tts->getLinkedTags('a', '=', 1); $linkedTags = $tts->getLinkedTags('a', '=', 1);
$this->assertSame(array(), $linkedTags); $this->assertSame(array(), $linkedTags);
$linkedTags = $tts->getLinkedTags('b', '=', 1); $linkedTags = $tts->getLinkedTags('b', '=', 1);
$this->assertSame(array('d'), $linkedTags); $this->assertSame(array('d'), $linkedTags);
$linkedTags = $tts->getLinkedTags('d', '=', 1); $linkedTags = $tts->getLinkedTags('d', '=', 1);
$this->assertEquals(3, sizeof($linkedTags)); $this->assertEquals(3, sizeof($linkedTags));
$this->assertTrue(in_array('b', $linkedTags)); // '=' is bijective $this->assertTrue(in_array('b', $linkedTags)); // '=' is bijective
$this->assertTrue(in_array('e', $linkedTags)); $this->assertTrue(in_array('e', $linkedTags));
$this->assertTrue(in_array('f', $linkedTags)); $this->assertTrue(in_array('f', $linkedTags));
$linkedTags = $tts->getLinkedTags('f', '=', 1); $linkedTags = $tts->getLinkedTags('f', '=', 1);
$this->assertEquals(1, sizeof($linkedTags)); $this->assertEquals(1, sizeof($linkedTags));
$this->assertTrue(in_array('d', $linkedTags)); // '=' is bijective $this->assertTrue(in_array('d', $linkedTags)); // '=' is bijective
// test allLinkTags (with inference) // test allLinkTags (with inference)
$allLinkedTags = $tts->getAllLinkedTags('a', '=', 1); $allLinkedTags = $tts->getAllLinkedTags('a', '=', 1);
$this->assertEquals(0, sizeof($allLinkedTags)); $this->assertEquals(0, sizeof($allLinkedTags));
$allLinkedTags = $tts->getAllLinkedTags('b', '=', 1); $allLinkedTags = $tts->getAllLinkedTags('b', '=', 1);
$this->assertEquals(3, sizeof($allLinkedTags)); $this->assertEquals(3, sizeof($allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$this->assertTrue(in_array('f', $allLinkedTags)); $this->assertTrue(in_array('f', $allLinkedTags));
$allLinkedTags = $tts->getAllLinkedTags('f', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('f', '>', 1);
$this->assertEquals(5, sizeof($allLinkedTags)); $this->assertEquals(5, sizeof($allLinkedTags));
$this->assertTrue(in_array('b', $allLinkedTags)); $this->assertTrue(in_array('b', $allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$this->assertTrue(in_array('c', $allLinkedTags)); $this->assertTrue(in_array('c', $allLinkedTags));
$this->assertTrue(in_array('g', $allLinkedTags)); $this->assertTrue(in_array('g', $allLinkedTags));
$allLinkedTags = $tts->getAllLinkedTags('a', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('a', '>', 1);
$this->assertEquals(6, sizeof($allLinkedTags)); $this->assertEquals(6, sizeof($allLinkedTags));
$this->assertTrue(in_array('b', $allLinkedTags)); $this->assertTrue(in_array('b', $allLinkedTags));
$this->assertTrue(in_array('c', $allLinkedTags)); $this->assertTrue(in_array('c', $allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$this->assertTrue(in_array('f', $allLinkedTags)); $this->assertTrue(in_array('f', $allLinkedTags));
$this->assertTrue(in_array('g', $allLinkedTags)); $this->assertTrue(in_array('g', $allLinkedTags));
$tts->addLinkedTags('g', 'h', '>', 1); $tts->addLinkedTags('g', 'h', '>', 1);
$tts->addLinkedTags('i', 'h', '=', 1); $tts->addLinkedTags('i', 'h', '=', 1);
$tts->addLinkedTags('j', 'f', '>', 1); $tts->addLinkedTags('j', 'f', '>', 1);
$allLinkedTags = $tts->getAllLinkedTags('j', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('j', '>', 1);
$this->assertEquals(8, sizeof($allLinkedTags)); $this->assertEquals(8, sizeof($allLinkedTags));
$this->assertTrue(in_array('b', $allLinkedTags)); $this->assertTrue(in_array('b', $allLinkedTags));
$this->assertTrue(in_array('c', $allLinkedTags)); $this->assertTrue(in_array('c', $allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$this->assertTrue(in_array('f', $allLinkedTags)); $this->assertTrue(in_array('f', $allLinkedTags));
$this->assertTrue(in_array('g', $allLinkedTags)); $this->assertTrue(in_array('g', $allLinkedTags));
$this->assertTrue(in_array('h', $allLinkedTags)); $this->assertTrue(in_array('h', $allLinkedTags));
$this->assertTrue(in_array('i', $allLinkedTags)); $this->assertTrue(in_array('i', $allLinkedTags));
// complex case: test cycle // complex case: test cycle
$tts->addLinkedTags('g', 'a', '>', 1); $tts->addLinkedTags('g', 'a', '>', 1);
$allLinkedTags = $tts->getAllLinkedTags('b', '>', 1); $allLinkedTags = $tts->getAllLinkedTags('b', '>', 1);
$this->assertEquals(8, sizeof($allLinkedTags)); $this->assertEquals(8, sizeof($allLinkedTags));
$this->assertTrue(in_array('a', $allLinkedTags)); $this->assertTrue(in_array('a', $allLinkedTags));
$this->assertTrue(in_array('c', $allLinkedTags)); $this->assertTrue(in_array('c', $allLinkedTags));
$this->assertTrue(in_array('d', $allLinkedTags)); $this->assertTrue(in_array('d', $allLinkedTags));
$this->assertTrue(in_array('e', $allLinkedTags)); $this->assertTrue(in_array('e', $allLinkedTags));
$this->assertTrue(in_array('f', $allLinkedTags)); $this->assertTrue(in_array('f', $allLinkedTags));
$this->assertTrue(in_array('g', $allLinkedTags)); $this->assertTrue(in_array('g', $allLinkedTags));
$this->assertTrue(in_array('h', $allLinkedTags)); $this->assertTrue(in_array('h', $allLinkedTags));
$this->assertTrue(in_array('i', $allLinkedTags)); $this->assertTrue(in_array('i', $allLinkedTags));
} }
// Test function that select the best tags to display? // Test function that select the best tags to display?
public function testViewTag2TagRelations() public function testViewTag2TagRelations()
{ {
$tts = $this->tts; $tts = $this->tts;
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('c', 'd', '>', 1); $tts->addLinkedTags('c', 'd', '>', 1);
$tts->addLinkedTags('d', 'e', '>', 1); $tts->addLinkedTags('d', 'e', '>', 1);
$tts->addLinkedTags('f', 'g', '>', 1); $tts->addLinkedTags('f', 'g', '>', 1);
$tts->addLinkedTags('f', 'h', '>', 1); $tts->addLinkedTags('f', 'h', '>', 1);
$tts->addLinkedTags('f', 'i', '>', 1); $tts->addLinkedTags('f', 'i', '>', 1);
$orphewTags = $tts->getOrphewTags('>', 1); $orphewTags = $tts->getOrphewTags('>', 1);
$this->assertEquals(3, sizeof($orphewTags)); $this->assertEquals(3, sizeof($orphewTags));
$this->assertSame('a', $orphewTags[0]['tag']); $this->assertSame('a', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']); $this->assertSame('c', $orphewTags[1]['tag']);
$this->assertSame('f', $orphewTags[2]['tag']); $this->assertSame('f', $orphewTags[2]['tag']);
// with limit // with limit
$orphewTags = $tts->getOrphewTags('>', 1, 2); $orphewTags = $tts->getOrphewTags('>', 1, 2);
$this->assertEquals(2, sizeof($orphewTags)); $this->assertEquals(2, sizeof($orphewTags));
$this->assertSame('a', $orphewTags[0]['tag']); $this->assertSame('a', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']); $this->assertSame('c', $orphewTags[1]['tag']);
// with sorting // with sorting
$orphewTags = $tts->getOrphewTags('>', 1, 2, 'nb'); // nb descendants $orphewTags = $tts->getOrphewTags('>', 1, 2, 'nb'); // nb descendants
$this->assertEquals(2, sizeof($orphewTags)); $this->assertEquals(2, sizeof($orphewTags));
$this->assertSame('f', $orphewTags[0]['tag']); $this->assertSame('f', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']); $this->assertSame('c', $orphewTags[1]['tag']);
$orphewTags = $tts->getOrphewTags('>', 1, 1, 'depth'); $orphewTags = $tts->getOrphewTags('>', 1, 1, 'depth');
$this->assertEquals(1, sizeof($orphewTags)); $this->assertEquals(1, sizeof($orphewTags));
$this->assertSame('c', $orphewTags[0]['tag']); $this->assertSame('c', $orphewTags[0]['tag']);
$orphewTags = $tts->getOrphewTags('>', 1, null, 'nbupdate'); $orphewTags = $tts->getOrphewTags('>', 1, null, 'nbupdate');
$this->assertEquals(3, sizeof($orphewTags)); $this->assertEquals(3, sizeof($orphewTags));
$this->assertSame('f', $orphewTags[0]['tag']); $this->assertSame('f', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']); $this->assertSame('c', $orphewTags[1]['tag']);
$this->assertSame('a', $orphewTags[2]['tag']); $this->assertSame('a', $orphewTags[2]['tag']);
} }
public function testAddLinkedTagsThroughBookmarking() public function testAddLinkedTagsThroughBookmarking()
{ {
$bs = $this->bs; $bs = $this->bs;
$tags = array('a>b', 'b>c', 'a>d>e', 'a>a', 'a', 'r=s', 's=t=u'); $tags = array('a>b', 'b>c', 'a>d>e', 'a>a', 'a', 'r=s', 's=t=u');
$bs->addBookmark("http://google.com", "title", "description", "status", $tags, null, false, false, 1); $bs->addBookmark("http://google.com", "title", "description", "status", $tags, null, false, false, 1);
$bookmark = $bs->getBookmarkByAddress("http://google.com"); $bookmark = $bs->getBookmarkByAddress("http://google.com");
$b2ts = $this->b2ts; $b2ts = $this->b2ts;
$savedTags = $b2ts->getTagsForBookmark(intval($bookmark['bId'])); $savedTags = $b2ts->getTagsForBookmark(intval($bookmark['bId']));
$this->assertEquals(6, sizeof($savedTags)); $this->assertEquals(6, sizeof($savedTags));
$this->assertContains('b', $savedTags); $this->assertContains('b', $savedTags);
$this->assertContains('c', $savedTags); $this->assertContains('c', $savedTags);
$this->assertContains('e', $savedTags); $this->assertContains('e', $savedTags);
$this->assertContains('a', $savedTags); $this->assertContains('a', $savedTags);
$this->assertContains('r', $savedTags); $this->assertContains('r', $savedTags);
$this->assertContains('s', $savedTags); $this->assertContains('s', $savedTags);
$tts = $this->tts; $tts = $this->tts;
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertEquals(2, sizeof($linkedTags)); $this->assertEquals(2, sizeof($linkedTags));
$this->assertSame('b', $linkedTags[0]['tag']); $this->assertSame('b', $linkedTags[0]['tag']);
$this->assertSame('d', $linkedTags[1]['tag']); $this->assertSame('d', $linkedTags[1]['tag']);
$linkedTags = $tts->getLinkedTags('b', '>', 1); $linkedTags = $tts->getLinkedTags('b', '>', 1);
$this->assertEquals(1, sizeof($linkedTags)); $this->assertEquals(1, sizeof($linkedTags));
$this->assertSame('c', $linkedTags[0]['tag']); $this->assertSame('c', $linkedTags[0]['tag']);
$this->assertTrue($tts->existsLinkedTags('d', 'e', '>', 1)); $this->assertTrue($tts->existsLinkedTags('d', 'e', '>', 1));
$this->assertFalse($tts->existsLinkedTags('e', 'd', '>', 1)); $this->assertFalse($tts->existsLinkedTags('e', 'd', '>', 1));
} }
public function testSearchThroughLinkedTags() public function testSearchThroughLinkedTags()
{ {
$tts = $this->tts; $tts = $this->tts;
$bs = $this->bs; $bs = $this->bs;
$tts->addLinkedTags('aa', 'bb', '>', 1); $tts->addLinkedTags('aa', 'bb', '>', 1);
$tags = array('aa>bb>cc', 'dd'); $tags = array('aa>bb>cc', 'dd');
$bs->addBookmark("web1.com", "B1", "description", "status", $tags, null, false, false, 1); $bs->addBookmark("web1.com", "B1", "description", "status", $tags, null, false, false, 1);
$tags = array('bb>gg', 'ee>ff'); $tags = array('bb>gg', 'ee>ff');
$bs->addBookmark("web2.com", "B2", "description", "status", $tags, null, false, false, 1); $bs->addBookmark("web2.com", "B2", "description", "status", $tags, null, false, false, 1);
$tags = array('ee=ii'); $tags = array('ee=ii');
$bs->addBookmark("web3.com", "B3", "description", "status", $tags, null, false, false, 1); $bs->addBookmark("web3.com", "B3", "description", "status", $tags, null, false, false, 1);
// Query format: // Query format:
// $bs->getBookmarks($start = 0, $perpage = NULL, $user = NULL, $tags = NULL, $terms = NULL, $sortOrder = NULL, $watched = NULL, $startdate = NULL, $enddate = NULL, $hash = NULL); // $bs->getBookmarks($start = 0, $perpage = NULL, $user = NULL, $tags = NULL, $terms = NULL, $sortOrder = NULL, $watched = NULL, $startdate = NULL, $enddate = NULL, $hash = NULL);
// basic queries // basic queries
$results = $bs->getBookmarks(0, NULL, 1, 'dd'); $results = $bs->getBookmarks(0, NULL, 1, 'dd');
$this->assertSame(1, intval($results['total'])); $this->assertSame(1, intval($results['total']));
$this->assertSame('B1', $results['bookmarks'][0]['bTitle']); $this->assertSame('B1', $results['bookmarks'][0]['bTitle']);
$results = $bs->getBookmarks(0, NULL, 1, 'cc'); $results = $bs->getBookmarks(0, NULL, 1, 'cc');
$this->assertSame(1, intval($results['total'])); $this->assertSame(1, intval($results['total']));
$this->assertSame('B1', $results['bookmarks'][0]['bTitle']); $this->assertSame('B1', $results['bookmarks'][0]['bTitle']);
//advanced queries //advanced queries
$results = $bs->getBookmarks(0, NULL, 1, 'aa'); $results = $bs->getBookmarks(0, NULL, 1, 'aa');
$this->assertSame(2, intval($results['total'])); $this->assertSame(2, intval($results['total']));
$this->assertSame('B1', $results['bookmarks'][0]['bTitle']); $this->assertSame('B1', $results['bookmarks'][0]['bTitle']);
$this->assertSame('B2', $results['bookmarks'][1]['bTitle']); $this->assertSame('B2', $results['bookmarks'][1]['bTitle']);
$results = $bs->getBookmarks(0, NULL, 1, 'ee'); $results = $bs->getBookmarks(0, NULL, 1, 'ee');
$this->assertSame(2, intval($results['total'])); $this->assertSame(2, intval($results['total']));
$this->assertSame('B2', $results['bookmarks'][1]['bTitle']); $this->assertSame('B2', $results['bookmarks'][1]['bTitle']);
$this->assertSame('B3', $results['bookmarks'][0]['bTitle']); $this->assertSame('B3', $results['bookmarks'][0]['bTitle']);
$results = $bs->getBookmarks(0, NULL, 1, 'ii'); $results = $bs->getBookmarks(0, NULL, 1, 'ii');
$this->assertSame(2, intval($results['total'])); $this->assertSame(2, intval($results['total']));
$this->assertSame('B2', $results['bookmarks'][1]['bTitle']); $this->assertSame('B2', $results['bookmarks'][1]['bTitle']);
$this->assertSame('B3', $results['bookmarks'][0]['bTitle']); $this->assertSame('B3', $results['bookmarks'][0]['bTitle']);
$results = $bs->getBookmarks(0, NULL, 1, 'aa+ee'); $results = $bs->getBookmarks(0, NULL, 1, 'aa+ee');
$this->assertSame(1, intval($results['total'])); $this->assertSame(1, intval($results['total']));
$this->assertSame('B2', $results['bookmarks'][0]['bTitle']); $this->assertSame('B2', $results['bookmarks'][0]['bTitle']);
} }
public function testStatsBetweenTags() public function testStatsBetweenTags()
{ {
$tsts = $this->tsts; $tsts = $this->tsts;
$tts = $this->tts; $tts = $this->tts;
// basic functions // basic functions
$this->assertFalse($tsts->existStat('a', '>', 10)); $this->assertFalse($tsts->existStat('a', '>', 10));
$tsts->setNbDescendants('a', '>', 10, 2); $tsts->setNbDescendants('a', '>', 10, 2);
$this->assertSame(2, $tsts->getNbDescendants('a', '>', 10)); $this->assertSame(2, $tsts->getNbDescendants('a', '>', 10));
$tsts->setMaxDepth('a', '>', 10, 3); $tsts->setMaxDepth('a', '>', 10, 3);
$this->assertSame(3, $tsts->getMaxDepth('a', '>', 10)); $this->assertSame(3, $tsts->getMaxDepth('a', '>', 10));
$this->assertTrue($tsts->existStat('a', '>', 10)); $this->assertTrue($tsts->existStat('a', '>', 10));
$this->assertFalse($tsts->existStat('a', '>', 20)); $this->assertFalse($tsts->existStat('a', '>', 20));
$tsts->increaseNbUpdate('a', '>', 10); $tsts->increaseNbUpdate('a', '>', 10);
$this->assertSame(1, $tsts->getNbUpdates('a', '>', 10)); $this->assertSame(1, $tsts->getNbUpdates('a', '>', 10));
$tsts->deleteAll(); $tsts->deleteAll();
// no structure // no structure
$nbC = $tsts->getNbChildren('a', '>', 1); $nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1); $nbD = $tsts->getNbDescendants('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1); $maxDepth = $tsts->getMaxDepth('a', '>', 1);
$this->assertSame(0, $nbC); $this->assertSame(0, $nbC);
$this->assertSame(0, $nbD); $this->assertSame(0, $nbD);
$this->assertSame(0, $maxDepth); $this->assertSame(0, $maxDepth);
// simple case // simple case
$tts->addLinkedTags('b', 'c', '>', 1); $tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('a', 'd', '>', 1); $tts->addLinkedTags('a', 'd', '>', 1);
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'e', '>', 1); $tts->addLinkedTags('b', 'e', '>', 1);
$this->assertSame(3, $tsts->getNbUpdates('a', '>', '1')); $this->assertSame(3, $tsts->getNbUpdates('a', '>', '1'));
$this->assertSame(2, $tsts->getNbUpdates('b', '>', '1')); $this->assertSame(2, $tsts->getNbUpdates('b', '>', '1'));
$this->assertSame(0, $tsts->getNbUpdates('c', '>', '1')); $this->assertSame(0, $tsts->getNbUpdates('c', '>', '1'));
$this->assertSame(0, $tsts->getNbUpdates('d', '>', '1')); $this->assertSame(0, $tsts->getNbUpdates('d', '>', '1'));
$this->assertSame(0, $tsts->getNbUpdates('e', '>', '1')); $this->assertSame(0, $tsts->getNbUpdates('e', '>', '1'));
$nbC = $tsts->getNbChildren('a', '>', 1); $nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1); $nbD = $tsts->getNbDescendants('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1); $maxDepth = $tsts->getMaxDepth('a', '>', 1);
$this->assertSame(2, $nbC); $this->assertSame(2, $nbC);
$this->assertSame(4, $nbD); $this->assertSame(4, $nbD);
$this->assertSame(2, $maxDepth); $this->assertSame(2, $maxDepth);
$nbC = $tsts->getNbChildren('b', '>', 1); $nbC = $tsts->getNbChildren('b', '>', 1);
$nbD = $tsts->getNbDescendants('b', '>', 1); $nbD = $tsts->getNbDescendants('b', '>', 1);
$maxDepth = $tsts->getMaxDepth('b', '>', 1); $maxDepth = $tsts->getMaxDepth('b', '>', 1);
$this->assertSame(2, $nbC); $this->assertSame(2, $nbC);
$this->assertSame(2, $nbD); $this->assertSame(2, $nbD);
$this->assertSame(1, $maxDepth); $this->assertSame(1, $maxDepth);
$nbC = $tsts->getNbChildren('c', '>', 1); $nbC = $tsts->getNbChildren('c', '>', 1);
$nbD = $tsts->getNbDescendants('c', '>', 1); $nbD = $tsts->getNbDescendants('c', '>', 1);
$maxDepth = $tsts->getMaxDepth('c', '>', 1); $maxDepth = $tsts->getMaxDepth('c', '>', 1);
$this->assertSame(0, $nbC); $this->assertSame(0, $nbC);
$this->assertSame(0, $nbD); $this->assertSame(0, $nbD);
$this->assertSame(0, $maxDepth); $this->assertSame(0, $maxDepth);
$nbC = $tsts->getNbChildren('d', '>', 1); $nbC = $tsts->getNbChildren('d', '>', 1);
$nbD = $tsts->getNbDescendants('d', '>', 1); $nbD = $tsts->getNbDescendants('d', '>', 1);
$maxDepth = $tsts->getMaxDepth('d', '>', 1); $maxDepth = $tsts->getMaxDepth('d', '>', 1);
$this->assertSame(0, $nbC); $this->assertSame(0, $nbC);
$this->assertSame(0, $nbD); $this->assertSame(0, $nbD);
$this->assertSame(0, $maxDepth); $this->assertSame(0, $maxDepth);
// deletion // deletion
$tts->removeLinkedTags('b', 'e', '>', 1); $tts->removeLinkedTags('b', 'e', '>', 1);
$nbC = $tsts->getNbChildren('b', '>', 1); $nbC = $tsts->getNbChildren('b', '>', 1);
$nbD = $tsts->getNbDescendants('b', '>', 1); $nbD = $tsts->getNbDescendants('b', '>', 1);
$maxDepth = $tsts->getMaxDepth('b', '>', 1); $maxDepth = $tsts->getMaxDepth('b', '>', 1);
$this->assertSame(1, $nbC); $this->assertSame(1, $nbC);
$this->assertSame(1, $nbD); $this->assertSame(1, $nbD);
$this->assertSame(1, $maxDepth); $this->assertSame(1, $maxDepth);
$nbC = $tsts->getNbChildren('a', '>', 1); $nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1); $nbD = $tsts->getNbDescendants('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1); $maxDepth = $tsts->getMaxDepth('a', '>', 1);
$this->assertSame(2, $nbC); $this->assertSame(2, $nbC);
$this->assertSame(3, $nbD); $this->assertSame(3, $nbD);
$this->assertSame(2, $maxDepth); $this->assertSame(2, $maxDepth);
//do cases for synonyms //do cases for synonyms
$this->markTestSkipped('Check stats'); $this->markTestSkipped('Check stats');
$tsts->deleteAll(); $tsts->deleteAll();
$tts->deleteAll(); $tts->deleteAll();
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'c', '=', 1); $tts->addLinkedTags('b', 'c', '=', 1);
/*$tts->addLinkedTags('a', 'c', '>', 1); /*$tts->addLinkedTags('a', 'c', '>', 1);
$tts->addLinkedTags('j', 'i', '=', 1); $tts->addLinkedTags('j', 'i', '=', 1);
$tts->addLinkedTags('f', 'i', '=', 1); $tts->addLinkedTags('f', 'i', '=', 1);
$tts->addLinkedTags('d', 'f', '>', 1); $tts->addLinkedTags('d', 'f', '>', 1);
$tts->addLinkedTags('d', 'e', '>', 1); $tts->addLinkedTags('d', 'e', '>', 1);
$tts->addLinkedTags('j', 'k', '>', 1);*/ $tts->addLinkedTags('j', 'k', '>', 1);*/
$nbC = $tsts->getNbChildren('a', '>', 1); $nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1); $nbD = $tsts->getNbDescendants('a', '>', 1);
$nbU = $tsts->getNbUpdates('a', '>', 1); $nbU = $tsts->getNbUpdates('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1); $maxDepth = $tsts->getMaxDepth('a', '>', 1);
//$this->assertSame(2, $tts->getLinkedTags('a', '>', 1)); //$this->assertSame(2, $tts->getLinkedTags('a', '>', 1));
$this->assertSame(1, $nbC); $this->assertSame(1, $nbC);
//$this->assertSame(2, $nbD); //$this->assertSame(2, $nbD);
$this->assertSame(2, $nbU); $this->assertSame(2, $nbU);
$this->assertSame(1, $maxDepth); $this->assertSame(1, $maxDepth);
// advanced case with fore loop // advanced case with fore loop
//$tts->addLinkedTags('d', 'c', '>', 1); //$tts->addLinkedTags('d', 'c', '>', 1);
// advanced case with back loop // advanced case with back loop
//$tts->addLinkedTags('e', 'a', '>', 1); //$tts->addLinkedTags('e', 'a', '>', 1);
} }
public function testRenameFunction() public function testRenameFunction()
{ {
$tts = $this->tts; $tts = $this->tts;
$b2ts = $this->b2ts; $b2ts = $this->b2ts;
$bs = $this->bs; $bs = $this->bs;
$tsts = $this->tsts; $tsts = $this->tsts;
$uid1 = $this->addUser(); $uid1 = $this->addUser();
$uid2 = $this->addUser(); $uid2 = $this->addUser();
// with classic tags (users 10 & 20) // with classic tags (users 10 & 20)
$bid1 = $bs->addBookmark( $bid1 = $bs->addBookmark(
"http://site1.com", "title", "description", 'note', 0, "http://site1.com", "title", "description", 'note', 0,
array('tag1', 'tag11', 'tag111'), null, false, false, array('tag1', 'tag11', 'tag111'), null, false, false,
$uid1 $uid1
); );
$bid2 = $bs->addBookmark( $bid2 = $bs->addBookmark(
"http://site1.com", "title2", "description2", 'note', 0, "http://site1.com", "title2", "description2", 'note', 0,
array('tag2', 'tag22', 'tag222'), null, false, false, array('tag2', 'tag22', 'tag222'), null, false, false,
$uid2 $uid2
); );
$bookmarks = $bs->getBookmarks(); $bookmarks = $bs->getBookmarks();
$this->assertEquals(1, $bookmarks['total']); $this->assertEquals(1, $bookmarks['total']);
$b2ts->renameTag($uid1, 'tag1', 'newtag1'); $b2ts->renameTag($uid1, 'tag1', 'newtag1');
$tags1 = $b2ts->getTagsForBookmark($bid1); $tags1 = $b2ts->getTagsForBookmark($bid1);
$this->assertContains('newtag1', $tags1); $this->assertContains('newtag1', $tags1);
$this->assertContains('tag11', $tags1); $this->assertContains('tag11', $tags1);
$this->assertContains('tag111', $tags1); $this->assertContains('tag111', $tags1);
//should not be changed //should not be changed
$tags2 = $b2ts->getTagsForBookmark($bid2); $tags2 = $b2ts->getTagsForBookmark($bid2);
$this->assertContains('tag2', $tags2); $this->assertContains('tag2', $tags2);
$this->assertContains('tag22', $tags2); $this->assertContains('tag22', $tags2);
$this->assertContains('tag222', $tags2); $this->assertContains('tag222', $tags2);
// with linked tags // with linked tags
$tts->addLinkedTags('b', 'c', '>', 1); $tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'a', '>', 2); // should not be modified because of userid $tts->addLinkedTags('b', 'a', '>', 2); // should not be modified because of userid
$tts->renameTag(1, 'b', 'e'); $tts->renameTag(1, 'b', 'e');
$linkedTags = $tts->getLinkedTags('e', '>', 1); $linkedTags = $tts->getLinkedTags('e', '>', 1);
$this->assertSame(array('c'), $linkedTags); $this->assertSame(array('c'), $linkedTags);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertSame(array('e'), $linkedTags); $this->assertSame(array('e'), $linkedTags);
$linkedTags = $tts->getLinkedTags('b', '>', 2); $linkedTags = $tts->getLinkedTags('b', '>', 2);
$this->assertSame(array('a'), $linkedTags); $this->assertSame(array('a'), $linkedTags);
//with stats //with stats
} }
// Cannot be test because the function use GLOBALS variables // Cannot be test because the function use GLOBALS variables
// not taken into account by tests // not taken into account by tests
/*public function testMenuTags() /*public function testMenuTags()
{ {
$tts = $this->tts; $tts = $this->tts;
$bs = $this->bs; $bs = $this->bs;
$bs->addBookmark("http://site1.com", "title", "description", "status", array('menu>tag1'), null, false, false, 1); $bs->addBookmark("http://site1.com", "title", "description", "status", array('menu>tag1'), null, false, false, 1);
$bs->addBookmark("http://site1.com", "title2", "description2", "status", array('menu>tag2>tag3'), null, false, false, 1); $bs->addBookmark("http://site1.com", "title2", "description2", "status", array('menu>tag2>tag3'), null, false, false, 1);
$bs->addBookmark("http://site1.com", "title3", "description3", "status", array('menu>tag1', 'menu>tag4'), null, false, false, 2); $bs->addBookmark("http://site1.com", "title3", "description3", "status", array('menu>tag1', 'menu>tag4'), null, false, false, 2);
$menuTags = $tts->getMenuTags($uId); $menuTags = $tts->getMenuTags($uId);
$this->assertEquals(3, sizeof($menuTags)); $this->assertEquals(3, sizeof($menuTags));
$this->assertContains('tag1', $menuTags); $this->assertContains('tag1', $menuTags);
$this->assertContains('tag2', $menuTags); $this->assertContains('tag2', $menuTags);
$this->assertContains('tag4', $menuTags); $this->assertContains('tag4', $menuTags);
}*/ }*/
} }
if (PHPUnit_MAIN_METHOD == 'Tag2TagTest::main') { if (PHPUnit_MAIN_METHOD == 'Tag2TagTest::main') {

View file

@ -28,7 +28,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
*/ */
class TagTest extends TestBase class TagTest extends TestBase
{ {
protected $ts; protected $ts;
@ -47,63 +47,63 @@ class TagTest extends TestBase
protected function setUp() protected function setUp()
{ {
$this->ts =SemanticScuttle_Service_Factory::get('Tag'); $this->ts =SemanticScuttle_Service_Factory::get('Tag');
$this->ts->deleteAll(); $this->ts->deleteAll();
$this->us =SemanticScuttle_Service_Factory::get('User'); $this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll(); $this->bs->deleteAll();
$this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$this->b2ts->deleteAll(); $this->b2ts->deleteAll();
$this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag'); $this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag');
$this->tts->deleteAll(); $this->tts->deleteAll();
$this->tsts =SemanticScuttle_Service_Factory::get('TagStat'); $this->tsts =SemanticScuttle_Service_Factory::get('TagStat');
$this->tsts->deleteAll(); $this->tsts->deleteAll();
} }
public function testTagDescriptions() public function testTagDescriptions()
{ {
$ts = $this->ts; $ts = $this->ts;
$desc = $ts->getAllDescriptions('tag1'); $desc = $ts->getAllDescriptions('tag1');
$this->assertSame(array(), $desc); $this->assertSame(array(), $desc);
$desc = $ts->getDescription('tag1', 1); // user 1 $desc = $ts->getDescription('tag1', 1); // user 1
$this->assertSame(array('tDescription'=>''), $desc); $this->assertSame(array('tDescription'=>''), $desc);
$desc1 = "test description"; $desc1 = "test description";
$ts->updateDescription('tag1', 1, $desc1); // first desc $ts->updateDescription('tag1', 1, $desc1); // first desc
$desc = $ts->getDescription('tag1', 1); $desc = $ts->getDescription('tag1', 1);
$this->assertEquals(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), $desc); $this->assertEquals(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), $desc);
$desc1 = "\"'(-è_çà)=´~#'#{{[\\\\[||`\^\^@^@}¹²¡×¿ ?./§µ%"; $desc1 = "\"'(-è_çà)=´~#'#{{[\\\\[||`\^\^@^@}¹²¡×¿ ?./§µ%";
$ts->updateDescription('tag1', 1, $desc1); // update desc $ts->updateDescription('tag1', 1, $desc1); // update desc
$desc = $ts->getDescription('tag1', 1); $desc = $ts->getDescription('tag1', 1);
$this->assertEquals(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), $desc); $this->assertEquals(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), $desc);
$desc2 = "æâ€êþÿûîîôôöŀï'üð’‘ßä«≤»©»  ↓¿×÷¡¹²³"; $desc2 = "æâ€êþÿûîîôôöŀï'üð’‘ßä«≤»©»  ↓¿×÷¡¹²³";
$ts->updateDescription('tag1', 2, $desc2); // user 2 $ts->updateDescription('tag1', 2, $desc2); // user 2
$desc = $ts->getDescription('tag1', 2); $desc = $ts->getDescription('tag1', 2);
$this->assertEquals(array('tag'=>'tag1', 'uId'=>2, 'tDescription'=>$desc2), $desc); $this->assertEquals(array('tag'=>'tag1', 'uId'=>2, 'tDescription'=>$desc2), $desc);
$desc = $ts->getAllDescriptions('tag1'); $desc = $ts->getAllDescriptions('tag1');
$this->assertEquals($desc, array(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), array('tag'=>'tag1', 'uId'=>2, 'tDescription'=>$desc2))); $this->assertEquals($desc, array(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), array('tag'=>'tag1', 'uId'=>2, 'tDescription'=>$desc2)));
} }
public function testRenameFunction() public function testRenameFunction()
{ {
$ts = $this->ts; $ts = $this->ts;
$ts->updateDescription('tag1', 10, 'xxx'); $ts->updateDescription('tag1', 10, 'xxx');
$ts->renameTag(10, 'tag1', 'tag2'); $ts->renameTag(10, 'tag1', 'tag2');
$desc = $ts->getDescription('tag1', 10); $desc = $ts->getDescription('tag1', 10);
$this->assertSame(array('tDescription'=>''), $desc); $this->assertSame(array('tDescription'=>''), $desc);
$desc = $ts->getDescription('tag2', 10); $desc = $ts->getDescription('tag2', 10);
$this->assertEquals(array('tag'=>'tag2', 'uId'=>10, 'tDescription'=>'xxx'), $desc); $this->assertEquals(array('tag'=>'tag2', 'uId'=>10, 'tDescription'=>'xxx'), $desc);
} }
} }

View file

@ -28,10 +28,10 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
*/ */
class TagsCacheTest extends PHPUnit_Framework_TestCase class TagsCacheTest extends PHPUnit_Framework_TestCase
{ {
protected $us; protected $us;
protected $bs; protected $bs;
protected $b2ts; protected $b2ts;
protected $tts; protected $tts;
@ -48,164 +48,164 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase
); );
} }
protected function setUp() protected function setUp()
{ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $debugMode; global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $debugMode;
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php'; require_once dirname(__FILE__) . '/../src/SemanticScuttle/header.php';
$this->us =SemanticScuttle_Service_Factory::get('User'); $this->us =SemanticScuttle_Service_Factory::get('User');
$this->bs =SemanticScuttle_Service_Factory::get('Bookmark'); $this->bs =SemanticScuttle_Service_Factory::get('Bookmark');
$this->bs->deleteAll(); $this->bs->deleteAll();
$this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag'); $this->b2ts =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$this->b2ts->deleteAll(); $this->b2ts->deleteAll();
$this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag'); $this->tts =SemanticScuttle_Service_Factory::get('Tag2Tag');
$this->tts->deleteAll(); $this->tts->deleteAll();
$this->tsts =SemanticScuttle_Service_Factory::get('TagStat'); $this->tsts =SemanticScuttle_Service_Factory::get('TagStat');
$this->tsts->deleteAll(); $this->tsts->deleteAll();
$this->tcs =SemanticScuttle_Service_Factory::get('TagCache'); $this->tcs =SemanticScuttle_Service_Factory::get('TagCache');
$this->tcs->deleteAll(); $this->tcs->deleteAll();
} }
public function testInclusionAllowsToAddAndDeleteChildrenTags() { public function testInclusionAllowsToAddAndDeleteChildrenTags() {
//message_die(GENERAL_ERROR, $GLOBALS['dbname'].'1'); //message_die(GENERAL_ERROR, $GLOBALS['dbname'].'1');
$tts = $this->tts; $tts = $this->tts;
$tcs = $this->tcs; $tcs = $this->tcs;
// test adding children // test adding children
$tcs->addChild('a', 'b', 1); $tcs->addChild('a', 'b', 1);
$tcs->addChild('a', 'c', 1); $tcs->addChild('a', 'c', 1);
$this->assertEquals(array('b','c'), $tcs->getChildren('a', 1)); $this->assertEquals(array('b','c'), $tcs->getChildren('a', 1));
// test adding a same child // test adding a same child
$tcs->addChild('a', 'b', 1); $tcs->addChild('a', 'b', 1);
$this->assertEquals(array('b','c'), $tcs->getChildren('a', 1)); $this->assertEquals(array('b','c'), $tcs->getChildren('a', 1));
// test removing a child // test removing a child
$tcs->removeChild('a', 'b', 1); $tcs->removeChild('a', 'b', 1);
$this->assertEquals(array('c'), $tcs->getChildren('a', 1)); $this->assertEquals(array('c'), $tcs->getChildren('a', 1));
// test removing a same child // test removing a same child
$tcs->removeChild('a', 'b', 1); $tcs->removeChild('a', 'b', 1);
$this->assertEquals(array('c'), $tcs->getChildren('a', 1)); $this->assertEquals(array('c'), $tcs->getChildren('a', 1));
// test existing child // test existing child
$this->assertTrue($tcs->existsChild('a', 'c', 1)); $this->assertTrue($tcs->existsChild('a', 'c', 1));
$this->assertTrue(!$tcs->existsChild('a', 'c', 2)); // wrong user $this->assertTrue(!$tcs->existsChild('a', 'c', 2)); // wrong user
$this->assertTrue(!$tcs->existsChild('a', 'b', 1)); // wrong child $this->assertTrue(!$tcs->existsChild('a', 'b', 1)); // wrong child
// test removing several children // test removing several children
$tcs->addChild('e', 'f', 1); $tcs->addChild('e', 'f', 1);
$tcs->addChild('e', 'g', 1); $tcs->addChild('e', 'g', 1);
$tcs->addChild('e', 'h', 1); $tcs->addChild('e', 'h', 1);
$tcs->removeChild('e', NULL, 1); $tcs->removeChild('e', NULL, 1);
$this->assertTrue(!$tcs->existsChild('e', 'f', 1)); $this->assertTrue(!$tcs->existsChild('e', 'f', 1));
$this->assertTrue(!$tcs->existsChild('e', 'g', 1)); $this->assertTrue(!$tcs->existsChild('e', 'g', 1));
$this->assertTrue(!$tcs->existsChild('e', 'h', 1)); $this->assertTrue(!$tcs->existsChild('e', 'h', 1));
} }
public function testInclusionCacheIsUpdatedWhenATag2TagLinkIsCreatedOrRemoved() { public function testInclusionCacheIsUpdatedWhenATag2TagLinkIsCreatedOrRemoved() {
$tts = $this->tts; $tts = $this->tts;
$tcs = $this->tcs; $tcs = $this->tcs;
// test inclusion without possible errors // test inclusion without possible errors
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'c', '>', 1); $tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('c', 'd', '>', 1); $tts->addLinkedTags('c', 'd', '>', 1);
$tts->addLinkedTags('e', 'f', '>', 1); $tts->addLinkedTags('e', 'f', '>', 1);
$tts->addLinkedTags('b', 'e', '>', 1); $tts->addLinkedTags('b', 'e', '>', 1);
$this->assertSame(array('b','c','d','e','f'), $tts->getAllLinkedTags('a', '>', 1)); $this->assertSame(array('b','c','d','e','f'), $tts->getAllLinkedTags('a', '>', 1));
$this->assertSame(array('c','d','e','f'), $tts->getAllLinkedTags('b', '>', 1)); $this->assertSame(array('c','d','e','f'), $tts->getAllLinkedTags('b', '>', 1));
// test inclusion with deletion // test inclusion with deletion
$tts->removeLinkedTags('b', 'c', '>', 1); $tts->removeLinkedTags('b', 'c', '>', 1);
$this->assertSame(array('b','e','f'), $tts->getAllLinkedTags('a', '>', 1)); $this->assertSame(array('b','e','f'), $tts->getAllLinkedTags('a', '>', 1));
$this->assertSame(array('e','f'), $tts->getAllLinkedTags('b', '>', 1)); $this->assertSame(array('e','f'), $tts->getAllLinkedTags('b', '>', 1));
$this->assertSame(array('d'), $tts->getAllLinkedTags('c', '>', 1)); $this->assertSame(array('d'), $tts->getAllLinkedTags('c', '>', 1));
$this->assertSame(array('f'), $tts->getAllLinkedTags('e', '>', 1)); $this->assertSame(array('f'), $tts->getAllLinkedTags('e', '>', 1));
} }
public function testInclusionResistsToTagCycles() { public function testInclusionResistsToTagCycles() {
$tts = $this->tts; $tts = $this->tts;
$tcs = $this->tcs; $tcs = $this->tcs;
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'c', '>', 1); $tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('c', 'a', '>', 1); // creates cycle a>c>a $tts->addLinkedTags('c', 'a', '>', 1); // creates cycle a>c>a
$this->assertSame(array('b','c'), $tts->getAllLinkedTags('a', '>', 1)); $this->assertSame(array('b','c'), $tts->getAllLinkedTags('a', '>', 1));
$this->assertSame(array('c', 'a'), $tts->getAllLinkedTags('b', '>', 1)); $this->assertSame(array('c', 'a'), $tts->getAllLinkedTags('b', '>', 1));
$this->assertSame(array('a', 'b'), $tts->getAllLinkedTags('c', '>', 1)); $this->assertSame(array('a', 'b'), $tts->getAllLinkedTags('c', '>', 1));
} }
public function testSynonymyAllowsToAddAndDeleteSynonyms() { public function testSynonymyAllowsToAddAndDeleteSynonyms() {
$tts = $this->tts; $tts = $this->tts;
$tcs = $this->tcs; $tcs = $this->tcs;
// simple synonymy // simple synonymy
$tcs->addSynonym('a', 'b', 1); $tcs->addSynonym('a', 'b', 1);
$tcs->addSynonym('a', 'c', 1); $tcs->addSynonym('a', 'c', 1);
$this->assertEquals(array('b', 'c'), $tcs->getSynonyms('a', 1)); $this->assertEquals(array('b', 'c'), $tcs->getSynonyms('a', 1));
$this->assertEquals(array('c', 'a'), $tcs->getSynonyms('b', 1)); $this->assertEquals(array('c', 'a'), $tcs->getSynonyms('b', 1));
$this->assertEquals(array('b', 'a'), $tcs->getSynonyms('c', 1)); $this->assertEquals(array('b', 'a'), $tcs->getSynonyms('c', 1));
//more advanced one 1 //more advanced one 1
$tcs->deleteByUser(1); $tcs->deleteByUser(1);
$tcs->addSynonym('a', 'b', 1); $tcs->addSynonym('a', 'b', 1);
$tcs->addSynonym('a', 'c', 1); $tcs->addSynonym('a', 'c', 1);
$tcs->addSynonym('d', 'e', 1); $tcs->addSynonym('d', 'e', 1);
$tcs->addSynonym('a', 'e', 1); $tcs->addSynonym('a', 'e', 1);
$this->assertEquals(array('b', 'c', 'e', 'd'), $tcs->getSynonyms('a', 1)); $this->assertEquals(array('b', 'c', 'e', 'd'), $tcs->getSynonyms('a', 1));
//more advanced one 2 //more advanced one 2
$tcs->deleteByUser(1); $tcs->deleteByUser(1);
$tcs->addSynonym('a', 'b', 1); $tcs->addSynonym('a', 'b', 1);
$tcs->addSynonym('a', 'c', 1); $tcs->addSynonym('a', 'c', 1);
$tcs->addSynonym('d', 'e', 1); $tcs->addSynonym('d', 'e', 1);
$tcs->addSynonym('a', 'd', 1); $tcs->addSynonym('a', 'd', 1);
$this->assertEquals(array('b', 'c', 'd', 'e'), $tcs->getSynonyms('a', 1)); $this->assertEquals(array('b', 'c', 'd', 'e'), $tcs->getSynonyms('a', 1));
//with Linked tags //with Linked tags
$tcs->deleteByUser(1); $tcs->deleteByUser(1);
$tts->addLinkedTags('a', 'b', '=', 1); $tts->addLinkedTags('a', 'b', '=', 1);
$tts->addLinkedTags('c', 'd', '=', 1); $tts->addLinkedTags('c', 'd', '=', 1);
$tts->addLinkedTags('c', 'e', '=', 1); $tts->addLinkedTags('c', 'e', '=', 1);
$tts->addLinkedTags('e', 'a', '=', 1); $tts->addLinkedTags('e', 'a', '=', 1);
$this->assertEquals(array('b', 'e', 'c', 'd'), $tts->getAllLinkedTags('a', '=', 1)); $this->assertEquals(array('b', 'e', 'c', 'd'), $tts->getAllLinkedTags('a', '=', 1));
} }
public function testInclusionTakesSynonymsIntoAccount() { public function testInclusionTakesSynonymsIntoAccount() {
$tts = $this->tts; $tts = $this->tts;
$tcs = $this->tcs; $tcs = $this->tcs;
$tts->addLinkedTags('a', 'b', '>', 1); $tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'c', '>', 1); $tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('d', 'e', '>', 1); $tts->addLinkedTags('d', 'e', '>', 1);
$tts->addLinkedTags('c', 'd', '=', 1); $tts->addLinkedTags('c', 'd', '=', 1);
// results are put into cache // results are put into cache
$this->assertEquals(array('b', 'c', 'd', 'e'), $tts->getAllLinkedTags('a', '>', 1)); $this->assertEquals(array('b', 'c', 'd', 'e'), $tts->getAllLinkedTags('a', '>', 1));
$this->assertEquals(array('d', 'e'), $tts->getAllLinkedTags('c', '>', 1)); $this->assertEquals(array('d', 'e'), $tts->getAllLinkedTags('c', '>', 1));
// same results must be taken out from cache // same results must be taken out from cache
$this->assertEquals(array('b', 'c', 'd', 'e'), $tts->getAllLinkedTags('a', '>', 1)); $this->assertEquals(array('b', 'c', 'd', 'e'), $tts->getAllLinkedTags('a', '>', 1));
$this->assertEquals(array('d', 'e'), $tts->getAllLinkedTags('c', '>', 1)); $this->assertEquals(array('d', 'e'), $tts->getAllLinkedTags('c', '>', 1));
// check that result comes from cache (artificial changes in cache must appear in result) // check that result comes from cache (artificial changes in cache must appear in result)
$tcs->removeChild('a', 'e', 1); $tcs->removeChild('a', 'e', 1);
$this->assertEquals(array('b', 'c', 'd'), $tts->getAllLinkedTags('a', '>', 1)); $this->assertEquals(array('b', 'c', 'd'), $tts->getAllLinkedTags('a', '>', 1));
//cache must be deleted for user when links are modified //cache must be deleted for user when links are modified
$tts->addLinkedTags('a', 'f', '=', 1); $tts->addLinkedTags('a', 'f', '=', 1);
$this->assertEquals(array(), $tcs->getChildren('a', 1)); $this->assertEquals(array(), $tcs->getChildren('a', 1));
$this->assertEquals(array(), $tcs->getSynonyms('d', 1)); $this->assertEquals(array(), $tcs->getSynonyms('d', 1));
} }
} }
if (PHPUnit_MAIN_METHOD == 'TagsCacheTest::main') { if (PHPUnit_MAIN_METHOD == 'TagsCacheTest::main') {