$conf = new ConfigManager('tests/utils/config/configJson');
$conf->set('resource.datastore', self::$testDatastore);
$refLinkDB = new \ReferenceLinkDB();
$conf = new ConfigManager('tests/utils/config/configJson');
$conf->set('resource.datastore', self::$testDatastore);
$refLinkDB = new \ReferenceLinkDB();
$history = new History('sandbox/history.php');
$factory = new FormatterFactory($conf, true);
self::$formatter = $factory->getFormatter();
$history = new History('sandbox/history.php');
$factory = new FormatterFactory($conf, true);
self::$formatter = $factory->getFormatter();
- self::$bookmarkService = new BookmarkFileService($conf, $history, true);
+ self::$bookmarkService = new BookmarkFileService($conf, $history, $mutex, true);
self::$serverInfo = array(
'HTTPS' => 'Off',
'SERVER_NAME' => 'host.tld',
'SERVER_PORT' => '80',
'SCRIPT_NAME' => '/index.php',
self::$serverInfo = array(
'HTTPS' => 'Off',
'SERVER_NAME' => 'host.tld',
'SERVER_PORT' => '80',
'SCRIPT_NAME' => '/index.php',
$this->assertEquals(self::$RSS_LANGUAGE, $data['language']);
$this->assertRegExp('/Wed, 03 Aug 2016 09:30:33 \+\d{4}/', $data['last_update']);
$this->assertEquals(true, $data['show_dates']);
$this->assertEquals(self::$RSS_LANGUAGE, $data['language']);
$this->assertRegExp('/Wed, 03 Aug 2016 09:30:33 \+\d{4}/', $data['last_update']);
$this->assertEquals(true, $data['show_dates']);
$this->assertEquals('http://host.tld/', $data['index_url']);
$this->assertFalse($data['usepermalinks']);
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
// Test first not pinned link (note link)
$this->assertEquals('http://host.tld/', $data['index_url']);
$this->assertFalse($data['usepermalinks']);
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
// Test first not pinned link (note link)
$this->assertEquals(41, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
$this->assertEquals(41, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
- $this->assertEquals('http://host.tld/?WDWyig', $link['guid']);
- $this->assertEquals('http://host.tld/?WDWyig', $link['url']);
+ $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
+ $this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
$this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']);
$pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']);
$up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']);
$this->assertEquals($pub, $up);
$this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']);
$pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']);
$up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']);
$this->assertEquals($pub, $up);
- $this->assertContains('Stallman has a beard', $link['description']);
- $this->assertContains('Permalink', $link['description']);
- $this->assertContains('http://host.tld/?WDWyig', $link['description']);
+ $this->assertContainsPolyfill('Stallman has a beard', $link['description']);
+ $this->assertContainsPolyfill('Permalink', $link['description']);
+ $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']);
$this->assertEquals(1, count($link['taglist']));
$this->assertEquals('sTuff', $link['taglist'][0]);
$this->assertEquals(1, count($link['taglist']));
$this->assertEquals('sTuff', $link['taglist'][0]);
$data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, null);
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
$this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']);
$data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, null);
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
$this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']);
$this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']);
$this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']);
}
$this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']);
$this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']);
}
$feedBuilder->setLocale(self::$LOCALE);
$data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, $criteria);
$this->assertEquals(3, count($data['links']));
$feedBuilder->setLocale(self::$LOCALE);
$data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, $criteria);
$this->assertEquals(3, count($data['links']));
$this->assertEquals(41, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
}
$this->assertEquals(41, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
}
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
$this->assertTrue($data['usepermalinks']);
// First link is a permalink
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
$this->assertTrue($data['usepermalinks']);
// First link is a permalink
$this->assertEquals(41, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
$this->assertEquals(41, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
- $this->assertEquals('http://host.tld/?WDWyig', $link['guid']);
- $this->assertEquals('http://host.tld/?WDWyig', $link['url']);
- $this->assertContains('Direct link', $link['description']);
- $this->assertContains('http://host.tld/?WDWyig', $link['description']);
+ $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
+ $this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
+ $this->assertContainsPolyfill('Direct link', $link['description']);
+ $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']);
$this->assertEquals(8, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
$this->assertEquals(8, $link['id']);
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
- $this->assertContains('Direct link', $link['description']);
- $this->assertContains('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']);
+ $this->assertContainsPolyfill('Direct link', $link['description']);
+ $this->assertContainsPolyfill('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']);
'SERVER_NAME' => 'host.tld',
'SERVER_PORT' => '8080',
'SCRIPT_NAME' => '/~user/shaarli/index.php',
'SERVER_NAME' => 'host.tld',
'SERVER_PORT' => '8080',
'SCRIPT_NAME' => '/~user/shaarli/index.php',
- $link = $data['links'][array_keys($data['links'])[2]];
- $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']);
- $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']);
- $this->assertContains('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']);
+ $link = $data['links'][array_keys($data['links'])[0]];
+ $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']);
+ $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']);
+ $this->assertContainsPolyfill('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']);