Coding style: manually fix remaining errors in tests after PHPCBF
Related to #95
This commit is contained in:
parent
0681511699
commit
830a73dcf6
61 changed files with 243 additions and 194 deletions
|
@ -71,5 +71,11 @@
|
||||||
"Shaarli\\Updater\\": "application/updater",
|
"Shaarli\\Updater\\": "application/updater",
|
||||||
"Shaarli\\Updater\\Exception\\": "application/updater/exception"
|
"Shaarli\\Updater\\Exception\\": "application/updater/exception"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Shaarli\\Tests\\": "tests",
|
||||||
|
"Shaarli\\Tests\\Utils\\": "tests/utils"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,11 @@
|
||||||
<!-- index.php bootstraps everything, so yes mixed symbols with side effects -->
|
<!-- index.php bootstraps everything, so yes mixed symbols with side effects -->
|
||||||
<exclude-pattern>index.php</exclude-pattern>
|
<exclude-pattern>index.php</exclude-pattern>
|
||||||
<exclude-pattern>plugins/*</exclude-pattern>
|
<exclude-pattern>plugins/*</exclude-pattern>
|
||||||
|
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
|
||||||
|
<exclude-pattern>tests/utils/RainTPL.php</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
|
||||||
|
<exclude-pattern>tests/utils/RainTPL.php</exclude-pattern>
|
||||||
</rule>
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
*/
|
*/
|
||||||
class ThumbnailerTest extends TestCase
|
class ThumbnailerTest extends TestCase
|
||||||
{
|
{
|
||||||
const WIDTH = 190;
|
protected const WIDTH = 190;
|
||||||
|
|
||||||
const HEIGHT = 210;
|
protected const HEIGHT = 210;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Thumbnailer;
|
* @var Thumbnailer;
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
* TimeZone's tests
|
* TimeZone's tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'application/TimeZone.php';
|
namespace Shaarli\Tests;
|
||||||
|
|
||||||
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for timezone utilities
|
* Unitary tests for timezone utilities
|
||||||
*/
|
*/
|
||||||
class TimeZoneTest extends \Shaarli\TestCase
|
class TimeZoneTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array of timezones
|
* @var array of timezones
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
* Utilities' tests
|
* Utilities' tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'application/Utils.php';
|
namespace Shaarli\Tests;
|
||||||
require_once 'application/Languages.php';
|
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for Shaarli utilities
|
* Unitary tests for Shaarli utilities
|
||||||
*/
|
*/
|
||||||
class UtilsTest extends \Shaarli\TestCase
|
class UtilsTest extends TestCase
|
||||||
{
|
{
|
||||||
// Log file
|
// Log file
|
||||||
protected static $testLogFile = 'tests.log';
|
protected static $testLogFile = 'tests.log';
|
||||||
|
@ -55,7 +56,7 @@ protected function setUp(): void
|
||||||
/**
|
/**
|
||||||
* Returns a list of the elements from the last logged entry
|
* Returns a list of the elements from the last logged entry
|
||||||
*
|
*
|
||||||
* @return list (date, ip address, message)
|
* @return array (date, ip address, message)
|
||||||
*/
|
*/
|
||||||
protected function getLastLogEntry()
|
protected function getLastLogEntry()
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -33,7 +34,7 @@ class ApiMiddlewareTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ protected function setUp(): void
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('api.secret', 'NapoleonWasALizard');
|
$this->conf->set('api.secret', 'NapoleonWasALizard');
|
||||||
|
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
|
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
use Slim\Http\Response;
|
use Slim\Http\Response;
|
||||||
|
|
||||||
require_once 'tests/utils/ReferenceHistory.php';
|
class HistoryTest extends TestCase
|
||||||
|
|
||||||
class HistoryTest extends \Shaarli\TestCase
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string datastore to test write operations
|
* @var string datastore to test write operations
|
||||||
|
@ -24,7 +24,7 @@ class HistoryTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceHistory instance.
|
* @var ReferenceHistory instance.
|
||||||
*/
|
*/
|
||||||
protected $refHistory = null;
|
protected $refHistory = null;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class HistoryTest extends \Shaarli\TestCase
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->refHistory = new \ReferenceHistory();
|
$this->refHistory = new ReferenceHistory();
|
||||||
$this->refHistory->write(self::$testHistory);
|
$this->refHistory->write(self::$testHistory);
|
||||||
$this->container = new Container();
|
$this->container = new Container();
|
||||||
$this->container['conf'] = $this->conf;
|
$this->container['conf'] = $this->conf;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -33,7 +34,7 @@ class InfoTest extends TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$this->pluginManager = new PluginManager($this->conf);
|
$this->pluginManager = new PluginManager($this->conf);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
|
@ -96,7 +97,7 @@ public function testGetInfo()
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$data = json_decode((string) $response->getBody(), true);
|
$data = json_decode((string) $response->getBody(), true);
|
||||||
|
|
||||||
$this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
||||||
$this->assertEquals(2, $data['private_counter']);
|
$this->assertEquals(2, $data['private_counter']);
|
||||||
$this->assertEquals('Shaarli', $data['settings']['title']);
|
$this->assertEquals('Shaarli', $data['settings']['title']);
|
||||||
$this->assertEquals('?', $data['settings']['header_link']);
|
$this->assertEquals('?', $data['settings']['header_link']);
|
||||||
|
@ -119,7 +120,7 @@ public function testGetInfo()
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$data = json_decode((string) $response->getBody(), true);
|
$data = json_decode((string) $response->getBody(), true);
|
||||||
|
|
||||||
$this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, $data['global_counter']);
|
||||||
$this->assertEquals(2, $data['private_counter']);
|
$this->assertEquals(2, $data['private_counter']);
|
||||||
$this->assertEquals($title, $data['settings']['title']);
|
$this->assertEquals($title, $data['settings']['title']);
|
||||||
$this->assertEquals($headerLink, $data['settings']['header_link']);
|
$this->assertEquals($headerLink, $data['settings']['header_link']);
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -30,7 +32,7 @@ class DeleteLinkTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -68,9 +70,9 @@ protected function setUp(): void
|
||||||
$this->mutex = new NoMutex();
|
$this->mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$refHistory = new \ReferenceHistory();
|
$refHistory = new ReferenceHistory();
|
||||||
$refHistory->write(self::$testHistory);
|
$refHistory->write(self::$testHistory);
|
||||||
$this->history = new History(self::$testHistory);
|
$this->history = new History(self::$testHistory);
|
||||||
$this->pluginManager = new PluginManager($this->conf);
|
$this->pluginManager = new PluginManager($this->conf);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -35,7 +36,7 @@ class GetLinkIdTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class GetLinkIdTest extends \Shaarli\TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON fields per link.
|
* Number of JSON fields per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_LINK = 9;
|
protected const NB_FIELDS_LINK = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -62,7 +63,7 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -36,7 +37,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class GetLinksTest extends \Shaarli\TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON field per link.
|
* Number of JSON field per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_LINK = 9;
|
protected const NB_FIELDS_LINK = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -63,7 +64,7 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
|
|
||||||
|
@ -431,7 +432,7 @@ public function testGetLinksSearchTags()
|
||||||
$response = $this->controller->getLinks($request, new Response());
|
$response = $this->controller->getLinks($request, new Response());
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$data = json_decode((string) $response->getBody(), true);
|
$data = json_decode((string) $response->getBody(), true);
|
||||||
$this->assertEquals(\ReferenceLinkDB::$NB_LINKS_TOTAL, count($data));
|
$this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data));
|
||||||
$this->assertEquals(10, $data[0]['id']);
|
$this->assertEquals(10, $data[0]['id']);
|
||||||
$this->assertEquals(41, $data[2]['id']);
|
$this->assertEquals(41, $data[2]['id']);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -40,7 +42,7 @@ class PostLinkTest extends TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -67,7 +69,7 @@ class PostLinkTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON field per link.
|
* Number of JSON field per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_LINK = 9;
|
protected const NB_FIELDS_LINK = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -77,9 +79,9 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$refHistory = new \ReferenceHistory();
|
$refHistory = new ReferenceHistory();
|
||||||
$refHistory->write(self::$testHistory);
|
$refHistory->write(self::$testHistory);
|
||||||
$this->history = new History(self::$testHistory);
|
$this->history = new History(self::$testHistory);
|
||||||
$pluginManager = new PluginManager($this->conf);
|
$pluginManager = new PluginManager($this->conf);
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -31,7 +33,7 @@ class PutLinkTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ class PutLinkTest extends \Shaarli\TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON field per link.
|
* Number of JSON field per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_LINK = 9;
|
protected const NB_FIELDS_LINK = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -68,9 +70,9 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$refHistory = new \ReferenceHistory();
|
$refHistory = new ReferenceHistory();
|
||||||
$refHistory->write(self::$testHistory);
|
$refHistory->write(self::$testHistory);
|
||||||
$this->history = new History(self::$testHistory);
|
$this->history = new History(self::$testHistory);
|
||||||
$pluginManager = new PluginManager($this->conf);
|
$pluginManager = new PluginManager($this->conf);
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -31,7 +33,7 @@ class DeleteTagTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -69,9 +71,9 @@ protected function setUp(): void
|
||||||
$this->mutex = new NoMutex();
|
$this->mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$refHistory = new \ReferenceHistory();
|
$refHistory = new ReferenceHistory();
|
||||||
$refHistory->write(self::$testHistory);
|
$refHistory->write(self::$testHistory);
|
||||||
$this->history = new History(self::$testHistory);
|
$this->history = new History(self::$testHistory);
|
||||||
$this->pluginManager = new PluginManager($this->conf);
|
$this->pluginManager = new PluginManager($this->conf);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -33,7 +34,7 @@ class GetTagNameTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class GetTagNameTest extends \Shaarli\TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON fields per link.
|
* Number of JSON fields per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_TAG = 2;
|
protected const NB_FIELDS_TAG = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -63,7 +64,7 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -33,7 +34,7 @@ class GetTagsTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ class GetTagsTest extends \Shaarli\TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON field per link.
|
* Number of JSON field per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_TAG = 2;
|
protected const NB_FIELDS_TAG = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -68,7 +69,7 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
$this->pluginManager = new PluginManager($this->conf);
|
$this->pluginManager = new PluginManager($this->conf);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceHistory;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -32,7 +34,7 @@ class PutTagTest extends \Shaarli\TestCase
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected $refDB = null;
|
protected $refDB = null;
|
||||||
|
|
||||||
|
@ -62,7 +64,7 @@ class PutTagTest extends \Shaarli\TestCase
|
||||||
/**
|
/**
|
||||||
* Number of JSON field per link.
|
* Number of JSON field per link.
|
||||||
*/
|
*/
|
||||||
const NB_FIELDS_TAG = 2;
|
protected const NB_FIELDS_TAG = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
* Before every test, instantiate a new Api with its config, plugins and bookmarks.
|
||||||
|
@ -72,9 +74,9 @@ protected function setUp(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
$this->conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$refHistory = new \ReferenceHistory();
|
$refHistory = new ReferenceHistory();
|
||||||
$refHistory->write(self::$testHistory);
|
$refHistory->write(self::$testHistory);
|
||||||
$this->history = new History(self::$testHistory);
|
$this->history = new History(self::$testHistory);
|
||||||
$this->pluginManager = new PluginManager($this->conf);
|
$this->pluginManager = new PluginManager($this->conf);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Shaarli\Bookmark;
|
namespace Shaarli\Bookmark;
|
||||||
|
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BookmarkArrayTest
|
* Class BookmarkArrayTest
|
||||||
|
@ -194,7 +195,7 @@ public function testArrayAccessIterate()
|
||||||
*/
|
*/
|
||||||
public function testReorder()
|
public function testReorder()
|
||||||
{
|
{
|
||||||
$refDB = new \ReferenceLinkDB();
|
$refDB = new ReferenceLinkDB();
|
||||||
$refDB->write('sandbox/datastore.php');
|
$refDB->write('sandbox/datastore.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use malkusch\lock\mutex\NoMutex;
|
use malkusch\lock\mutex\NoMutex;
|
||||||
use ReferenceLinkDB;
|
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use Shaarli;
|
use Shaarli;
|
||||||
use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
|
use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
|
||||||
|
@ -17,6 +16,8 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\FakeBookmarkService;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for LegacyLinkDBTest
|
* Unitary tests for LegacyLinkDBTest
|
||||||
|
@ -95,7 +96,7 @@ protected function setUp(): void
|
||||||
$this->conf = new ConfigManager(self::$testConf);
|
$this->conf = new ConfigManager(self::$testConf);
|
||||||
$this->conf->set('resource.datastore', self::$testDatastore);
|
$this->conf->set('resource.datastore', self::$testDatastore);
|
||||||
$this->conf->set('resource.updates', self::$testUpdates);
|
$this->conf->set('resource.updates', self::$testUpdates);
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$this->history = new History('sandbox/history.php');
|
$this->history = new History('sandbox/history.php');
|
||||||
$this->pluginManager = new PluginManager($this->conf);
|
$this->pluginManager = new PluginManager($this->conf);
|
||||||
|
@ -124,12 +125,12 @@ public function testDatabaseMigration()
|
||||||
define('SHAARLI_VERSION', 'dev');
|
define('SHAARLI_VERSION', 'dev');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->refDB = new \ReferenceLinkDB(true);
|
$this->refDB = new ReferenceLinkDB(true);
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
$db = self::getMethod('migrate');
|
$db = self::getMethod('migrate');
|
||||||
$db->invokeArgs($this->privateLinkDB, []);
|
$db->invokeArgs($this->privateLinkDB, []);
|
||||||
|
|
||||||
$db = new \FakeBookmarkService(
|
$db = new FakeBookmarkService(
|
||||||
$this->conf,
|
$this->conf,
|
||||||
$this->pluginManager,
|
$this->pluginManager,
|
||||||
$this->history,
|
$this->history,
|
||||||
|
@ -204,7 +205,7 @@ public function testAddFull()
|
||||||
$this->assertEquals($updated, $bookmark->getUpdated());
|
$this->assertEquals($updated, $bookmark->getUpdated());
|
||||||
|
|
||||||
// reload from file
|
// reload from file
|
||||||
$this->privateLinkDB = new \FakeBookmarkService(
|
$this->privateLinkDB = new FakeBookmarkService(
|
||||||
$this->conf,
|
$this->conf,
|
||||||
$this->pluginManager,
|
$this->pluginManager,
|
||||||
$this->history,
|
$this->history,
|
||||||
|
@ -715,7 +716,7 @@ public function testCheckDBNewLoggedOut()
|
||||||
{
|
{
|
||||||
unlink(self::$testDatastore);
|
unlink(self::$testDatastore);
|
||||||
$this->assertFileNotExists(self::$testDatastore);
|
$this->assertFileNotExists(self::$testDatastore);
|
||||||
$db = new \FakeBookmarkService($this->conf, $this->pluginManager, $this->history, $this->mutex, false);
|
$db = new FakeBookmarkService($this->conf, $this->pluginManager, $this->history, $this->mutex, false);
|
||||||
$this->assertFileNotExists(self::$testDatastore);
|
$this->assertFileNotExists(self::$testDatastore);
|
||||||
$this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks());
|
$this->assertInstanceOf(BookmarkArray::class, $db->getBookmarks());
|
||||||
$this->assertCount(0, $db->getBookmarks());
|
$this->assertCount(0, $db->getBookmarks());
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
namespace Shaarli\Bookmark;
|
namespace Shaarli\Bookmark;
|
||||||
|
|
||||||
use malkusch\lock\mutex\NoMutex;
|
use malkusch\lock\mutex\NoMutex;
|
||||||
use ReferenceLinkDB;
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\FakeBookmarkService;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BookmarkFilterTest.
|
* Class BookmarkFilterTest.
|
||||||
|
@ -46,10 +47,10 @@ public static function setUpBeforeClass(): void
|
||||||
$conf = new ConfigManager('tests/utils/config/configJson');
|
$conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$conf->set('resource.datastore', self::$testDatastore);
|
$conf->set('resource.datastore', self::$testDatastore);
|
||||||
static::$pluginManager = new PluginManager($conf);
|
static::$pluginManager = new PluginManager($conf);
|
||||||
self::$refDB = new \ReferenceLinkDB();
|
self::$refDB = new ReferenceLinkDB();
|
||||||
self::$refDB->write(self::$testDatastore);
|
self::$refDB->write(self::$testDatastore);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
self::$bookmarkService = new \FakeBookmarkService($conf, static::$pluginManager, $history, $mutex, true);
|
self::$bookmarkService = new FakeBookmarkService($conf, static::$pluginManager, $history, $mutex, true);
|
||||||
self::$linkFilter = new BookmarkFilter(self::$bookmarkService->getBookmarks(), $conf, static::$pluginManager);
|
self::$linkFilter = new BookmarkFilter(self::$bookmarkService->getBookmarks(), $conf, static::$pluginManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BookmarkInitializerTest
|
* Class BookmarkInitializerTest
|
||||||
|
@ -73,7 +74,7 @@ public function setUp(): void
|
||||||
*/
|
*/
|
||||||
public function testInitializeNotEmptyDataStore(): void
|
public function testInitializeNotEmptyDataStore(): void
|
||||||
{
|
{
|
||||||
$refDB = new \ReferenceLinkDB();
|
$refDB = new ReferenceLinkDB();
|
||||||
$refDB->write(self::$testDatastore);
|
$refDB->write(self::$testDatastore);
|
||||||
$this->bookmarkService = new BookmarkFileService(
|
$this->bookmarkService = new BookmarkFileService(
|
||||||
$this->conf,
|
$this->conf,
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
require_once 'tests/utils/CurlUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LinkUtilsTest.
|
* Class LinkUtilsTest.
|
||||||
*/
|
*/
|
||||||
|
@ -701,7 +699,10 @@ public function testTagsFilterWithSpaceSeparator(): void
|
||||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter(['tag1', 'tag2', 'tag3'], $separator));
|
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter(['tag1', 'tag2', 'tag3'], $separator));
|
||||||
static::assertSame(['tag1,', 'tag2@', 'tag3'], tags_filter(['tag1,', 'tag2@', 'tag3'], $separator));
|
static::assertSame(['tag1,', 'tag2@', 'tag3'], tags_filter(['tag1,', 'tag2@', 'tag3'], $separator));
|
||||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter([' tag1 ', 'tag2', 'tag3 '], $separator));
|
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter([' tag1 ', 'tag2', 'tag3 '], $separator));
|
||||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter([' tag1 ', ' ', 'tag2', ' ', 'tag3 '], $separator));
|
static::assertSame(
|
||||||
|
['tag1', 'tag2', 'tag3'],
|
||||||
|
tags_filter([' tag1 ', ' ', 'tag2', ' ', 'tag3 '], $separator)
|
||||||
|
);
|
||||||
static::assertSame(['tag1'], tags_filter([' tag1 '], $separator));
|
static::assertSame(['tag1'], tags_filter([' tag1 '], $separator));
|
||||||
static::assertSame([], tags_filter([' '], $separator));
|
static::assertSame([], tags_filter([' '], $separator));
|
||||||
static::assertSame([], tags_filter([], $separator));
|
static::assertSame([], tags_filter([], $separator));
|
||||||
|
@ -721,7 +722,10 @@ public function testTagsArrayFilterWithSpaceSeparator(): void
|
||||||
['tag1', 'tag2, and other', 'tag3'],
|
['tag1', 'tag2, and other', 'tag3'],
|
||||||
tags_filter(['@@@@ tag1@@@', ' @tag2, and other @', 'tag3@@@@'], $separator)
|
tags_filter(['@@@@ tag1@@@', ' @tag2, and other @', 'tag3@@@@'], $separator)
|
||||||
);
|
);
|
||||||
static::assertSame(['tag1', 'tag2', 'tag3'], tags_filter(['@@@tag1@@@', '@', 'tag2', '@@@', 'tag3@@@'], $separator));
|
static::assertSame(
|
||||||
|
['tag1', 'tag2', 'tag3'],
|
||||||
|
tags_filter(['@@@tag1@@@', '@', 'tag2', '@@@', 'tag3@@@'], $separator)
|
||||||
|
);
|
||||||
static::assertSame(['tag1'], tags_filter(['@@@@tag1@@@@'], $separator));
|
static::assertSame(['tag1'], tags_filter(['@@@@tag1@@@@'], $separator));
|
||||||
static::assertSame([], tags_filter(['@@@'], $separator));
|
static::assertSame([], tags_filter(['@@@'], $separator));
|
||||||
static::assertSame([], tags_filter([], $separator));
|
static::assertSame([], tags_filter([], $separator));
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
require_once 'vendor/autoload.php';
|
require_once 'vendor/autoload.php';
|
||||||
|
|
||||||
|
use Shaarli\Tests\Utils\ReferenceSessionIdHashes;
|
||||||
|
|
||||||
$conf = new \Shaarli\Config\ConfigManager('tests/utils/config/configJson');
|
$conf = new \Shaarli\Config\ConfigManager('tests/utils/config/configJson');
|
||||||
new \Shaarli\Languages('en', $conf);
|
new \Shaarli\Languages('en', $conf);
|
||||||
|
|
||||||
|
@ -13,23 +15,26 @@ function is_iterable($var)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove this after fixing UT
|
// raw functions
|
||||||
|
require_once 'application/config/ConfigPlugin.php';
|
||||||
require_once 'application/bookmark/LinkUtils.php';
|
require_once 'application/bookmark/LinkUtils.php';
|
||||||
require_once 'application/Utils.php';
|
|
||||||
require_once 'application/http/UrlUtils.php';
|
require_once 'application/http/UrlUtils.php';
|
||||||
require_once 'application/http/HttpUtils.php';
|
require_once 'application/http/HttpUtils.php';
|
||||||
|
require_once 'application/Utils.php';
|
||||||
|
require_once 'application/TimeZone.php';
|
||||||
|
require_once 'tests/utils/CurlUtils.php';
|
||||||
|
require_once 'tests/utils/RainTPL.php';
|
||||||
|
|
||||||
|
// TODO: remove this after fixing UT
|
||||||
require_once 'tests/TestCase.php';
|
require_once 'tests/TestCase.php';
|
||||||
require_once 'tests/container/ShaarliTestContainer.php';
|
require_once 'tests/container/ShaarliTestContainer.php';
|
||||||
require_once 'tests/front/controller/visitor/FrontControllerMockHelper.php';
|
require_once 'tests/front/controller/visitor/FrontControllerMockHelper.php';
|
||||||
require_once 'tests/front/controller/admin/FrontAdminControllerMockHelper.php';
|
require_once 'tests/front/controller/admin/FrontAdminControllerMockHelper.php';
|
||||||
require_once 'tests/updater/DummyUpdater.php';
|
|
||||||
require_once 'tests/utils/FakeBookmarkService.php';
|
|
||||||
require_once 'tests/utils/FakeConfigManager.php';
|
require_once 'tests/utils/FakeConfigManager.php';
|
||||||
require_once 'tests/utils/ReferenceHistory.php';
|
require_once 'tests/utils/ReferenceHistory.php';
|
||||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
require_once 'tests/utils/ReferenceLinkDB.php';
|
||||||
require_once 'tests/utils/ReferenceSessionIdHashes.php';
|
|
||||||
|
|
||||||
\ReferenceSessionIdHashes::genAllHashes();
|
ReferenceSessionIdHashes::genAllHashes();
|
||||||
|
|
||||||
if (!defined('SHAARLI_MUTEX_FILE')) {
|
if (!defined('SHAARLI_MUTEX_FILE')) {
|
||||||
define('SHAARLI_MUTEX_FILE', __FILE__);
|
define('SHAARLI_MUTEX_FILE', __FILE__);
|
||||||
|
|
|
@ -4,13 +4,12 @@
|
||||||
|
|
||||||
use Shaarli\Config\Exception\PluginConfigOrderException;
|
use Shaarli\Config\Exception\PluginConfigOrderException;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
|
use Shaarli\TestCase;
|
||||||
require_once 'application/config/ConfigPlugin.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for Shaarli config related functions
|
* Unitary tests for Shaarli config related functions
|
||||||
*/
|
*/
|
||||||
class ConfigPluginTest extends \Shaarli\TestCase
|
class ConfigPluginTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test save_plugin_config with valid data.
|
* Test save_plugin_config with valid data.
|
||||||
|
@ -54,7 +53,7 @@ public function testSavePluginConfigValid()
|
||||||
*/
|
*/
|
||||||
public function testSavePluginConfigInvalid()
|
public function testSavePluginConfigInvalid()
|
||||||
{
|
{
|
||||||
$this->expectException(\Shaarli\Config\Exception\PluginConfigOrderException::class);
|
$this->expectException(PluginConfigOrderException::class);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'plugin2' => 0,
|
'plugin2' => 0,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use malkusch\lock\mutex\NoMutex;
|
use malkusch\lock\mutex\NoMutex;
|
||||||
use ReferenceLinkDB;
|
|
||||||
use Shaarli\Bookmark\Bookmark;
|
use Shaarli\Bookmark\Bookmark;
|
||||||
use Shaarli\Bookmark\BookmarkFileService;
|
use Shaarli\Bookmark\BookmarkFileService;
|
||||||
use Shaarli\Bookmark\LinkDB;
|
use Shaarli\Bookmark\LinkDB;
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FeedBuilderTest class.
|
* FeedBuilderTest class.
|
||||||
|
@ -52,7 +52,7 @@ public static function setUpBeforeClass(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$conf = new ConfigManager('tests/utils/config/configJson');
|
$conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
$conf->set('resource.datastore', self::$testDatastore);
|
$conf->set('resource.datastore', self::$testDatastore);
|
||||||
$refLinkDB = new \ReferenceLinkDB();
|
$refLinkDB = new ReferenceLinkDB();
|
||||||
$refLinkDB->write(self::$testDatastore);
|
$refLinkDB->write(self::$testDatastore);
|
||||||
$history = new History('sandbox/history.php');
|
$history = new History('sandbox/history.php');
|
||||||
$factory = new FormatterFactory($conf, true);
|
$factory = new FormatterFactory($conf, true);
|
||||||
|
@ -100,7 +100,10 @@ public function testRSSBuildData()
|
||||||
// Test first not pinned link (note link)
|
// Test first not pinned link (note link)
|
||||||
$link = $data['links'][array_keys($data['links'])[0]];
|
$link = $data['links'][array_keys($data['links'])[0]];
|
||||||
$this->assertEquals(41, $link['id']);
|
$this->assertEquals(41, $link['id']);
|
||||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
$this->assertEquals(
|
||||||
|
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||||
|
$link['created']
|
||||||
|
);
|
||||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
|
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
|
||||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
|
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
|
||||||
$this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']);
|
$this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']);
|
||||||
|
@ -164,7 +167,10 @@ public function testBuildDataFiltered()
|
||||||
$this->assertEquals(1, count($data['links']));
|
$this->assertEquals(1, count($data['links']));
|
||||||
$link = array_shift($data['links']);
|
$link = array_shift($data['links']);
|
||||||
$this->assertEquals(41, $link['id']);
|
$this->assertEquals(41, $link['id']);
|
||||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
$this->assertEquals(
|
||||||
|
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||||
|
$link['created']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,7 +192,10 @@ public function testBuildDataCount()
|
||||||
$this->assertEquals(3, count($data['links']));
|
$this->assertEquals(3, count($data['links']));
|
||||||
$link = $data['links'][array_keys($data['links'])[0]];
|
$link = $data['links'][array_keys($data['links'])[0]];
|
||||||
$this->assertEquals(41, $link['id']);
|
$this->assertEquals(41, $link['id']);
|
||||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
$this->assertEquals(
|
||||||
|
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||||
|
$link['created']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,7 +217,10 @@ public function testBuildDataPermalinks()
|
||||||
// First link is a permalink
|
// First link is a permalink
|
||||||
$link = $data['links'][array_keys($data['links'])[0]];
|
$link = $data['links'][array_keys($data['links'])[0]];
|
||||||
$this->assertEquals(41, $link['id']);
|
$this->assertEquals(41, $link['id']);
|
||||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
|
$this->assertEquals(
|
||||||
|
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'),
|
||||||
|
$link['created']
|
||||||
|
);
|
||||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
|
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
|
||||||
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
|
$this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
|
||||||
$this->assertContainsPolyfill('Direct link', $link['description']);
|
$this->assertContainsPolyfill('Direct link', $link['description']);
|
||||||
|
@ -216,7 +228,10 @@ public function testBuildDataPermalinks()
|
||||||
// Second link is a direct link
|
// Second link is a direct link
|
||||||
$link = $data['links'][array_keys($data['links'])[1]];
|
$link = $data['links'][array_keys($data['links'])[1]];
|
||||||
$this->assertEquals(8, $link['id']);
|
$this->assertEquals(8, $link['id']);
|
||||||
$this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
|
$this->assertEquals(
|
||||||
|
DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'),
|
||||||
|
$link['created']
|
||||||
|
);
|
||||||
$this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']);
|
$this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']);
|
||||||
$this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']);
|
$this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']);
|
||||||
$this->assertContainsPolyfill('Direct link', $link['description']);
|
$this->assertContainsPolyfill('Direct link', $link['description']);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class PluginsControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use FrontAdminControllerMockHelper;
|
use FrontAdminControllerMockHelper;
|
||||||
|
|
||||||
const PLUGIN_NAMES = ['plugin1', 'plugin2', 'plugin3', 'plugin4'];
|
protected const PLUGIN_NAMES = ['plugin1', 'plugin2', 'plugin3', 'plugin4'];
|
||||||
|
|
||||||
/** @var PluginsController */
|
/** @var PluginsController */
|
||||||
protected $controller;
|
protected $controller;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class InstallControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use FrontControllerMockHelper;
|
use FrontControllerMockHelper;
|
||||||
|
|
||||||
const MOCK_FILE = '.tmp';
|
protected const MOCK_FILE = '.tmp';
|
||||||
|
|
||||||
/** @var InstallController */
|
/** @var InstallController */
|
||||||
protected $controller;
|
protected $controller;
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
namespace Shaarli\Helper;
|
namespace Shaarli\Helper;
|
||||||
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\FakeApplicationUtils;
|
use Shaarli\Tests\Utils\FakeApplicationUtils;
|
||||||
|
|
||||||
require_once 'tests/utils/FakeApplicationUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for Shaarli utilities
|
* Unitary tests for Shaarli utilities
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
namespace Shaarli\Helper;
|
namespace Shaarli\Helper;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Shaarli\Bookmark\Bookmark;
|
use Shaarli\Bookmark\Bookmark;
|
||||||
|
@ -209,31 +210,31 @@ public function getRequestedTypes(): array
|
||||||
public function getRequestedDateTimes(): array
|
public function getRequestedDateTimes(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[DailyPageHelper::DAY, '20201013', null, new \DateTime('2020-10-13')],
|
[DailyPageHelper::DAY, '20201013', null, new DateTime('2020-10-13')],
|
||||||
[
|
[
|
||||||
DailyPageHelper::DAY,
|
DailyPageHelper::DAY,
|
||||||
'',
|
'',
|
||||||
(new Bookmark())->setCreated($date = new \DateTime('2020-10-13 12:05:31')),
|
(new Bookmark())->setCreated($date = new DateTime('2020-10-13 12:05:31')),
|
||||||
$date,
|
$date,
|
||||||
],
|
],
|
||||||
[DailyPageHelper::DAY, '', null, new \DateTime()],
|
[DailyPageHelper::DAY, '', null, new DateTime()],
|
||||||
[DailyPageHelper::WEEK, '202030', null, new \DateTime('2020-07-20')],
|
[DailyPageHelper::WEEK, '202030', null, new DateTime('2020-07-20')],
|
||||||
[
|
[
|
||||||
DailyPageHelper::WEEK,
|
DailyPageHelper::WEEK,
|
||||||
'',
|
'',
|
||||||
(new Bookmark())->setCreated($date = new \DateTime('2020-10-13 12:05:31')),
|
(new Bookmark())->setCreated($date = new DateTime('2020-10-13 12:05:31')),
|
||||||
new \DateTime('2020-10-13'),
|
new DateTime('2020-10-13'),
|
||||||
],
|
],
|
||||||
[DailyPageHelper::WEEK, '', null, new \DateTime(), 'Ym'],
|
[DailyPageHelper::WEEK, '', null, new DateTime(), 'Ym'],
|
||||||
[DailyPageHelper::MONTH, '202008', null, new \DateTime('2020-08-01'), 'Ym'],
|
[DailyPageHelper::MONTH, '202008', null, new DateTime('2020-08-01'), 'Ym'],
|
||||||
[
|
[
|
||||||
DailyPageHelper::MONTH,
|
DailyPageHelper::MONTH,
|
||||||
'',
|
'',
|
||||||
(new Bookmark())->setCreated($date = new \DateTime('2020-10-13 12:05:31')),
|
(new Bookmark())->setCreated($date = new DateTime('2020-10-13 12:05:31')),
|
||||||
new \DateTime('2020-10-13'),
|
new DateTime('2020-10-13'),
|
||||||
'Ym'
|
'Ym'
|
||||||
],
|
],
|
||||||
[DailyPageHelper::MONTH, '', null, new \DateTime(), 'Ym'],
|
[DailyPageHelper::MONTH, '', null, new DateTime(), 'Ym'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,9 +256,9 @@ public function getFormatsByType(): array
|
||||||
public function getStartDatesByType(): array
|
public function getStartDatesByType(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-09 00:00:00')],
|
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-09 00:00:00')],
|
||||||
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-05 00:00:00')],
|
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-05 00:00:00')],
|
||||||
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-01 00:00:00')],
|
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-01 00:00:00')],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,9 +268,9 @@ public function getStartDatesByType(): array
|
||||||
public function getEndDatesByType(): array
|
public function getEndDatesByType(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-09 23:59:59')],
|
[DailyPageHelper::DAY, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-09 23:59:59')],
|
||||||
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-11 23:59:59')],
|
[DailyPageHelper::WEEK, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-11 23:59:59')],
|
||||||
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new \DateTime('2020-10-31 23:59:59')],
|
[DailyPageHelper::MONTH, new DateTimeImmutable('2020-10-09 04:05:06'), new DateTime('2020-10-31 23:59:59')],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,20 +323,20 @@ public function getCacheDatePeriodByType(): array
|
||||||
[
|
[
|
||||||
DailyPageHelper::DAY,
|
DailyPageHelper::DAY,
|
||||||
new DateTimeImmutable('2020-10-09 04:05:06'),
|
new DateTimeImmutable('2020-10-09 04:05:06'),
|
||||||
new \DateTime('2020-10-09 00:00:00'),
|
new DateTime('2020-10-09 00:00:00'),
|
||||||
new \DateTime('2020-10-09 23:59:59'),
|
new DateTime('2020-10-09 23:59:59'),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
DailyPageHelper::WEEK,
|
DailyPageHelper::WEEK,
|
||||||
new DateTimeImmutable('2020-10-09 04:05:06'),
|
new DateTimeImmutable('2020-10-09 04:05:06'),
|
||||||
new \DateTime('2020-10-05 00:00:00'),
|
new DateTime('2020-10-05 00:00:00'),
|
||||||
new \DateTime('2020-10-11 23:59:59'),
|
new DateTime('2020-10-11 23:59:59'),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
DailyPageHelper::MONTH,
|
DailyPageHelper::MONTH,
|
||||||
new DateTimeImmutable('2020-10-09 04:05:06'),
|
new DateTimeImmutable('2020-10-09 04:05:06'),
|
||||||
new \DateTime('2020-10-01 00:00:00'),
|
new DateTime('2020-10-01 00:00:00'),
|
||||||
new \DateTime('2020-10-31 23:59:59'),
|
new DateTime('2020-10-31 23:59:59'),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for client_ip_id()
|
* Unitary tests for client_ip_id()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for get_http_response()
|
* Unitary tests for get_http_response()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for getIpAddressFromProxy()
|
* Unitary tests for getIpAddressFromProxy()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for index_url()
|
* Unitary tests for index_url()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class IsHttpsTest
|
* Class IsHttpsTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for page_url()
|
* Unitary tests for page_url()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/HttpUtils.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for server_url()
|
* Unitary tests for server_url()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/UrlUtils.php';
|
|
||||||
|
|
||||||
class CleanupUrlTest extends \Shaarli\TestCase
|
class CleanupUrlTest extends \Shaarli\TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/UrlUtils.php';
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
class GetUrlSchemeTest extends \Shaarli\TestCase
|
class GetUrlSchemeTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get empty scheme string for empty UrlUtils
|
* Get empty scheme string for empty UrlUtils
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/UrlUtils.php';
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for unparse_url()
|
* Unitary tests for unparse_url()
|
||||||
*/
|
*/
|
||||||
class UnparseUrlTest extends \Shaarli\TestCase
|
class UnparseUrlTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Thanks for building nothing
|
* Thanks for building nothing
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
namespace Shaarli\Http;
|
namespace Shaarli\Http;
|
||||||
|
|
||||||
require_once 'application/http/UrlUtils.php';
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class WhitelistProtocolsTest
|
* Class WhitelistProtocolsTest
|
||||||
*
|
*
|
||||||
* Test whitelist_protocols() function of UrlUtils.
|
* Test whitelist_protocols() function of UrlUtils.
|
||||||
*/
|
*/
|
||||||
class WhitelistProtocolsTest extends \Shaarli\TestCase
|
class WhitelistProtocolsTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test whitelist_protocols() on a note (relative URL).
|
* Test whitelist_protocols() on a note (relative URL).
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'tests/UtilsTest.php';
|
namespace Shaarli\Tests;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
class UtilsDeTest extends UtilsTest
|
class UtilsDeTest extends UtilsTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'tests/UtilsTest.php';
|
namespace Shaarli\Tests;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
class UtilsEnTest extends UtilsTest
|
class UtilsEnTest extends UtilsTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Shaarli;
|
namespace Shaarli\Tests;
|
||||||
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
|
use Shaarli\Languages;
|
||||||
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LanguagesFrTest
|
* Class LanguagesFrTest
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @package Shaarli
|
* @package Shaarli
|
||||||
*/
|
*/
|
||||||
class LanguagesFrTest extends \Shaarli\TestCase
|
class LanguagesFrTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string Config file path (without extension).
|
* @var string Config file path (without extension).
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'tests/UtilsTest.php';
|
namespace Shaarli\Tests;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
class UtilsFrTest extends UtilsTest
|
class UtilsFrTest extends UtilsTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,14 +7,10 @@
|
||||||
namespace Shaarli\Legacy;
|
namespace Shaarli\Legacy;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use ReferenceLinkDB;
|
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use Shaarli;
|
use Shaarli;
|
||||||
use Shaarli\Bookmark\Bookmark;
|
use Shaarli\Bookmark\Bookmark;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
require_once 'application/Utils.php';
|
|
||||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unitary tests for LegacyLinkDBTest
|
* Unitary tests for LegacyLinkDBTest
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
namespace Shaarli\Bookmark;
|
namespace Shaarli\Bookmark;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use ReferenceLinkDB;
|
|
||||||
use Shaarli\Legacy\LegacyLinkDB;
|
use Shaarli\Legacy\LegacyLinkDB;
|
||||||
use Shaarli\Legacy\LegacyLinkFilter;
|
use Shaarli\Legacy\LegacyLinkFilter;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LegacyLinkFilterTest.
|
* Class LegacyLinkFilterTest.
|
||||||
|
|
|
@ -10,18 +10,16 @@
|
||||||
use Shaarli\Config\ConfigPhp;
|
use Shaarli\Config\ConfigPhp;
|
||||||
use Shaarli\Legacy\LegacyLinkDB;
|
use Shaarli\Legacy\LegacyLinkDB;
|
||||||
use Shaarli\Legacy\LegacyUpdater;
|
use Shaarli\Legacy\LegacyUpdater;
|
||||||
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\updater\DummyUpdater;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
use Shaarli\Thumbnailer;
|
use Shaarli\Thumbnailer;
|
||||||
|
|
||||||
require_once 'application/updater/UpdaterUtils.php';
|
|
||||||
require_once 'tests/updater/DummyUpdater.php';
|
|
||||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
|
||||||
require_once 'inc/rain.tpl.class.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UpdaterTest.
|
* Class UpdaterTest.
|
||||||
* Runs unit tests against the updater class.
|
* Runs unit tests against the updater class.
|
||||||
*/
|
*/
|
||||||
class LegacyUpdaterTest extends \Shaarli\TestCase
|
class LegacyUpdaterTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string Path to test datastore.
|
* @var string Path to test datastore.
|
||||||
|
@ -226,7 +224,7 @@ public function testMergeDeprecatedConfigNoFile()
|
||||||
*/
|
*/
|
||||||
public function testRenameDashTags()
|
public function testRenameDashTags()
|
||||||
{
|
{
|
||||||
$refDB = new \ReferenceLinkDB(true);
|
$refDB = new ReferenceLinkDB(true);
|
||||||
$refDB->write(self::$testDatastore);
|
$refDB->write(self::$testDatastore);
|
||||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||||
|
|
||||||
|
@ -369,7 +367,7 @@ public function testDatastoreIds()
|
||||||
'private' => true,
|
'private' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$refDB = new \ReferenceLinkDB(true);
|
$refDB = new ReferenceLinkDB(true);
|
||||||
$refDB->setLinks($links);
|
$refDB->setLinks($links);
|
||||||
$refDB->write(self::$testDatastore);
|
$refDB->write(self::$testDatastore);
|
||||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||||
|
@ -438,7 +436,7 @@ public function testDatastoreIds()
|
||||||
*/
|
*/
|
||||||
public function testDatastoreIdsNothingToDo()
|
public function testDatastoreIdsNothingToDo()
|
||||||
{
|
{
|
||||||
$refDB = new \ReferenceLinkDB(true);
|
$refDB = new ReferenceLinkDB(true);
|
||||||
$refDB->write(self::$testDatastore);
|
$refDB->write(self::$testDatastore);
|
||||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||||
|
|
||||||
|
@ -782,7 +780,7 @@ public function testUpdateStickyValid()
|
||||||
1 => ['id' => 1] + $blank,
|
1 => ['id' => 1] + $blank,
|
||||||
2 => ['id' => 2] + $blank,
|
2 => ['id' => 2] + $blank,
|
||||||
];
|
];
|
||||||
$refDB = new \ReferenceLinkDB(true);
|
$refDB = new ReferenceLinkDB(true);
|
||||||
$refDB->setLinks($links);
|
$refDB->setLinks($links);
|
||||||
$refDB->write(self::$testDatastore);
|
$refDB->write(self::$testDatastore);
|
||||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||||
|
@ -813,7 +811,7 @@ public function testUpdateStickyNothingToDo()
|
||||||
1 => ['id' => 1, 'sticky' => true] + $blank,
|
1 => ['id' => 1, 'sticky' => true] + $blank,
|
||||||
2 => ['id' => 2] + $blank,
|
2 => ['id' => 2] + $blank,
|
||||||
];
|
];
|
||||||
$refDB = new \ReferenceLinkDB(true);
|
$refDB = new ReferenceLinkDB(true);
|
||||||
$refDB->setLinks($links);
|
$refDB->setLinks($links);
|
||||||
$refDB->write(self::$testDatastore);
|
$refDB->write(self::$testDatastore);
|
||||||
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
$linkDB = new LegacyLinkDB(self::$testDatastore, true, false);
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
require_once 'tests/utils/ReferenceLinkDB.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Netscape bookmark export
|
* Netscape bookmark export
|
||||||
|
@ -29,7 +28,7 @@ class BookmarkExportTest extends TestCase
|
||||||
protected static $conf;
|
protected static $conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \ReferenceLinkDB instance.
|
* @var ReferenceLinkDB instance.
|
||||||
*/
|
*/
|
||||||
protected static $refDb = null;
|
protected static $refDb = null;
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ public static function setUpBeforeClass(): void
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
static::$conf = new ConfigManager('tests/utils/config/configJson');
|
static::$conf = new ConfigManager('tests/utils/config/configJson');
|
||||||
static::$conf->set('resource.datastore', static::$testDatastore);
|
static::$conf->set('resource.datastore', static::$testDatastore);
|
||||||
static::$refDb = new \ReferenceLinkDB();
|
static::$refDb = new ReferenceLinkDB();
|
||||||
static::$refDb->write(static::$testDatastore);
|
static::$refDb->write(static::$testDatastore);
|
||||||
static::$history = new History('sandbox/history.php');
|
static::$history = new History('sandbox/history.php');
|
||||||
static::$pluginManager = new PluginManager(static::$conf);
|
static::$pluginManager = new PluginManager(static::$conf);
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Plugin\Archiveorg;
|
namespace Shaarli\Plugin\Archiveorg;
|
||||||
|
|
||||||
/**
|
|
||||||
* PluginArchiveorgTest.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,14 @@ public function testIssoMultipleLinks(): void
|
||||||
|
|
||||||
$processed = hook_isso_render_linklist($data, $conf);
|
$processed = hook_isso_render_linklist($data, $conf);
|
||||||
// link_plugin should be added for the icon
|
// link_plugin should be added for the icon
|
||||||
$this->assertContainsPolyfill('<a href="/shaare/' . $short1 . '#isso-thread">', $processed['links'][0]['link_plugin'][0]);
|
$this->assertContainsPolyfill(
|
||||||
$this->assertContainsPolyfill('<a href="/shaare/' . $short2 . '#isso-thread">', $processed['links'][1]['link_plugin'][0]);
|
'<a href="/shaare/' . $short1 . '#isso-thread">',
|
||||||
|
$processed['links'][0]['link_plugin'][0]
|
||||||
|
);
|
||||||
|
$this->assertContainsPolyfill(
|
||||||
|
'<a href="/shaare/' . $short2 . '#isso-thread">',
|
||||||
|
$processed['links'][1]['link_plugin'][0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,7 +153,10 @@ public function testIssoNotDisplayedWhenSearch(): void
|
||||||
$processed = hook_isso_render_linklist($data, $conf);
|
$processed = hook_isso_render_linklist($data, $conf);
|
||||||
|
|
||||||
// link_plugin should be added for the icon
|
// link_plugin should be added for the icon
|
||||||
$this->assertContainsPolyfill('<a href="/shaare/' . $short1 . '#isso-thread">', $processed['links'][0]['link_plugin'][0]);
|
$this->assertContainsPolyfill(
|
||||||
|
'<a href="/shaare/' . $short1 . '#isso-thread">',
|
||||||
|
$processed['links'][0]['link_plugin'][0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Plugin\Playvideos;
|
namespace Shaarli\Plugin\Playvideos;
|
||||||
|
|
||||||
/**
|
|
||||||
* PluginPlayvideosTest.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\Render\TemplatePage;
|
use Shaarli\Render\TemplatePage;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
namespace Shaarli\Plugin\Qrcode;
|
namespace Shaarli\Plugin\Qrcode;
|
||||||
|
|
||||||
/**
|
|
||||||
* PluginQrcodeTest.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\Render\TemplatePage;
|
use Shaarli\Render\TemplatePage;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use Shaarli\FakeConfigManager;
|
use Shaarli\FakeConfigManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceSessionIdHashes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test coverage for SessionManager
|
* Test coverage for SessionManager
|
||||||
|
@ -27,7 +28,7 @@ class SessionManagerTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public static function setUpBeforeClass(): void
|
public static function setUpBeforeClass(): void
|
||||||
{
|
{
|
||||||
self::$sidHashes = \ReferenceSessionIdHashes::getHashes();
|
self::$sidHashes = ReferenceSessionIdHashes::getHashes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Shaarli\Updater;
|
namespace Shaarli\Tests\updater;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
use Shaarli\Bookmark\BookmarkFileService;
|
use Shaarli\Bookmark\BookmarkFileService;
|
||||||
use Shaarli\Bookmark\LinkDB;
|
use Shaarli\Bookmark\LinkDB;
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
|
use Shaarli\Updater\Updater;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DummyUpdater.
|
* Class DummyUpdater.
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
use Shaarli\Plugin\PluginManager;
|
use Shaarli\Plugin\PluginManager;
|
||||||
use Shaarli\TestCase;
|
use Shaarli\TestCase;
|
||||||
|
use Shaarli\Tests\updater\DummyUpdater;
|
||||||
|
use Shaarli\Tests\Utils\ReferenceLinkDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UpdaterTest.
|
* Class UpdaterTest.
|
||||||
|
@ -35,7 +37,7 @@ class UpdaterTest extends TestCase
|
||||||
/** @var BookmarkServiceInterface */
|
/** @var BookmarkServiceInterface */
|
||||||
protected $bookmarkService;
|
protected $bookmarkService;
|
||||||
|
|
||||||
/** @var \ReferenceLinkDB */
|
/** @var ReferenceLinkDB */
|
||||||
protected $refDB;
|
protected $refDB;
|
||||||
|
|
||||||
/** @var Updater */
|
/** @var Updater */
|
||||||
|
@ -47,7 +49,7 @@ class UpdaterTest extends TestCase
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$mutex = new NoMutex();
|
$mutex = new NoMutex();
|
||||||
$this->refDB = new \ReferenceLinkDB();
|
$this->refDB = new ReferenceLinkDB();
|
||||||
$this->refDB->write(self::$testDatastore);
|
$this->refDB->write(self::$testDatastore);
|
||||||
|
|
||||||
copy('tests/utils/config/configJson.json.php', self::$configFile . '.json.php');
|
copy('tests/utils/config/configJson.json.php', self::$configFile . '.json.php');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Shaarli;
|
namespace Shaarli\Tests\Utils;
|
||||||
|
|
||||||
use Shaarli\Helper\ApplicationUtils;
|
use Shaarli\Helper\ApplicationUtils;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Shaarli\Bookmark\BookmarkArray;
|
namespace Shaarli\Tests\Utils;
|
||||||
use Shaarli\Bookmark\BookmarkFilter;
|
|
||||||
use Shaarli\Bookmark\BookmarkIO;
|
|
||||||
use Shaarli\Bookmark\BookmarkFileService;
|
use Shaarli\Bookmark\BookmarkFileService;
|
||||||
use Shaarli\Bookmark\Exception\EmptyDataStoreException;
|
|
||||||
use Shaarli\Config\ConfigManager;
|
|
||||||
use Shaarli\History;
|
|
||||||
|
|
||||||
class FakeBookmarkService extends BookmarkFileService
|
class FakeBookmarkService extends BookmarkFileService
|
||||||
{
|
{
|
||||||
|
|
6
tests/utils/RainTPL.php
Normal file
6
tests/utils/RainTPL.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class RainTPL
|
||||||
|
{
|
||||||
|
public static $tpl_dir = '';
|
||||||
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Shaarli\Tests\Utils;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use Shaarli\Helper\FileUtils;
|
use Shaarli\Helper\FileUtils;
|
||||||
use Shaarli\History;
|
use Shaarli\History;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Shaarli\Tests\Utils;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use Shaarli\Bookmark\Bookmark;
|
use Shaarli\Bookmark\Bookmark;
|
||||||
use Shaarli\Bookmark\BookmarkArray;
|
use Shaarli\Bookmark\BookmarkArray;
|
||||||
|
|
||||||
|
@ -10,11 +13,11 @@ class ReferenceLinkDB
|
||||||
{
|
{
|
||||||
public static $NB_LINKS_TOTAL = 11;
|
public static $NB_LINKS_TOTAL = 11;
|
||||||
|
|
||||||
private $bookmarks = [];
|
protected $bookmarks = [];
|
||||||
private $_publicCount = 0;
|
protected $publicCount = 0;
|
||||||
private $_privateCount = 0;
|
protected $privateCount = 0;
|
||||||
|
|
||||||
private $isLegacy;
|
protected $isLegacy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the test DB with reference data
|
* Populates the test DB with reference data
|
||||||
|
@ -184,10 +187,10 @@ protected function addLink(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($private) {
|
if ($private) {
|
||||||
$this->_privateCount++;
|
$this->privateCount++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->_publicCount++;
|
$this->publicCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,7 +236,7 @@ public function reorder($order = 'DESC')
|
||||||
*/
|
*/
|
||||||
public function countLinks()
|
public function countLinks()
|
||||||
{
|
{
|
||||||
return $this->_publicCount + $this->_privateCount;
|
return $this->publicCount + $this->privateCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,7 +244,7 @@ public function countLinks()
|
||||||
*/
|
*/
|
||||||
public function countPublicLinks()
|
public function countPublicLinks()
|
||||||
{
|
{
|
||||||
return $this->_publicCount;
|
return $this->publicCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +252,7 @@ public function countPublicLinks()
|
||||||
*/
|
*/
|
||||||
public function countPrivateLinks()
|
public function countPrivateLinks()
|
||||||
{
|
{
|
||||||
return $this->_privateCount;
|
return $this->privateCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Shaarli\Tests\Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing the untestable - Session ID generation
|
* Testing the untestable - Session ID generation
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue