mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Reorganize PDO tests into namespaces
This commit is contained in:
parent
4bada691e9
commit
095fe10aec
52 changed files with 425 additions and 341 deletions
|
@ -10,6 +10,7 @@ const BASE = __DIR__.DIRECTORY_SEPARATOR;
|
||||||
$paths = [
|
$paths = [
|
||||||
__FILE__,
|
__FILE__,
|
||||||
BASE."arsse.php",
|
BASE."arsse.php",
|
||||||
|
BASE."RoboFile.php",
|
||||||
BASE."lib",
|
BASE."lib",
|
||||||
BASE."tests",
|
BASE."tests",
|
||||||
];
|
];
|
||||||
|
|
|
@ -128,4 +128,13 @@ class RoboFile extends \Robo\Tasks {
|
||||||
$this->_exec("git worktree prune");
|
$this->_exec("git worktree prune");
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clean($opts = ['demo|d' => false]): Result {
|
||||||
|
$t = $this->taskExec(realpath(self::BASE."vendor/bin/php-cs-fixer"));
|
||||||
|
$t->arg("fix");
|
||||||
|
if ($opts['demo']) {
|
||||||
|
$t->args("--dry-run", "--diff")->option("--diff-format", "udiff");
|
||||||
|
}
|
||||||
|
return $t->run();
|
||||||
|
}
|
||||||
}
|
}
|
4
robo
4
robo
|
@ -3,4 +3,8 @@ base=`dirname "$0"`
|
||||||
roboCommand="$1"
|
roboCommand="$1"
|
||||||
|
|
||||||
shift
|
shift
|
||||||
|
if [ "$1" == "clean" ]; then
|
||||||
|
"$base/vendor/bin/robo" "$roboCommand" $*
|
||||||
|
else
|
||||||
"$base/vendor/bin/robo" "$roboCommand" -- $*
|
"$base/vendor/bin/robo" "$roboCommand" -- $*
|
||||||
|
fi
|
4
robo.bat
4
robo.bat
|
@ -14,4 +14,8 @@ if "%~1" neq "" (
|
||||||
)
|
)
|
||||||
if defined args set args=%args:~1%
|
if defined args set args=%args:~1%
|
||||||
|
|
||||||
|
if "%1"=="clean" (
|
||||||
|
call "%base%vendor\bin\robo" "%roboCommand%" %args%
|
||||||
|
) else (
|
||||||
call "%base%vendor\bin\robo" "%roboCommand%" -- %args%
|
call "%base%vendor\bin\robo" "%roboCommand%" -- %args%
|
||||||
|
)
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Conf;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Conf */
|
/** @covers \JKingWeb\Arsse\Conf */
|
||||||
class TestConf extends Test\AbstractTest {
|
class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public static $vfs;
|
public static $vfs;
|
||||||
public static $path;
|
public static $path;
|
||||||
|
|
||||||
|
|
14
tests/cases/Db/SQLite3/Database/TestArticle.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestArticle.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestArticle extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesArticle;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3/Database/TestCleanup.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestCleanup.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestCleanup extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesCleanup;
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseArticleSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesArticle;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseCleanupSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesCleanup;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseFeedSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesFeed;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseFolderSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesFolder;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseLabelSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesLabel;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseMetaSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesMeta;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseMiscellanySQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesMiscellany;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseSessionSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesSession;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseSubscriptionSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesSubscription;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
/** @license MIT
|
|
||||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
||||||
* See LICENSE and AUTHORS files for details */
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Database<extended> */
|
|
||||||
class TestDatabaseUserSQLite3 extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3;
|
|
||||||
use Test\Database\SeriesUser;
|
|
||||||
}
|
|
14
tests/cases/Db/SQLite3/Database/TestFeed.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestFeed.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesFeed;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3/Database/TestFolder.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestFolder.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestFolder extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesFolder;
|
||||||
|
}
|
10
tests/cases/Db/SQLite3/Database/TestLabel.php
Normal file
10
tests/cases/Db/SQLite3/Database/TestLabel.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestLabel extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesLabel;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3/Database/TestMeta.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestMeta.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestMeta extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesMeta;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3/Database/TestMiscellany.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestMiscellany.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestMiscellany extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesMiscellany;
|
||||||
|
}
|
10
tests/cases/Db/SQLite3/Database/TestSession.php
Normal file
10
tests/cases/Db/SQLite3/Database/TestSession.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestSession extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesSession;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3/Database/TestSubscription.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestSubscription.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestSubscription extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesSubscription;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3/Database/TestUser.php
Normal file
14
tests/cases/Db/SQLite3/Database/TestUser.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/** @license MIT
|
||||||
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||||
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesUser;
|
||||||
|
}
|
|
@ -4,9 +4,10 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
|
||||||
|
|
||||||
use JKingWeb\Arsse\Arsse;
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
@ -14,7 +15,7 @@ use Phake;
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbDriverCreationSQLite3 extends Test\AbstractTest {
|
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
protected $ch;
|
protected $ch;
|
|
@ -4,12 +4,19 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\Result;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbDriverSQLite3 extends Test\AbstractTest {
|
class TestDriver extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
protected $ch;
|
protected $ch;
|
||||||
|
@ -21,10 +28,10 @@ class TestDbDriverSQLite3 extends Test\AbstractTest {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
Arsse::$conf = $conf;
|
Arsse::$conf = $conf;
|
||||||
$conf->dbDriver = Db\SQLite3\Driver::class;
|
$conf->dbDriver = Driver::class;
|
||||||
$conf->dbSQLite3Timeout = 0;
|
$conf->dbSQLite3Timeout = 0;
|
||||||
$conf->dbSQLite3File = tempnam(sys_get_temp_dir(), 'ook');
|
$conf->dbSQLite3File = tempnam(sys_get_temp_dir(), 'ook');
|
||||||
$this->drv = new Db\SQLite3\Driver();
|
$this->drv = new Driver();
|
||||||
$this->ch = new \SQLite3(Arsse::$conf->dbSQLite3File);
|
$this->ch = new \SQLite3(Arsse::$conf->dbSQLite3File);
|
||||||
$this->ch->enableExceptions(true);
|
$this->ch->enableExceptions(true);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +87,7 @@ class TestDbDriverSQLite3 extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMakeAValidQuery() {
|
public function testMakeAValidQuery() {
|
||||||
$this->assertInstanceOf(Db\Result::class, $this->drv->query("SELECT 1"));
|
$this->assertInstanceOf(Result::class, $this->drv->query("SELECT 1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMakeAnInvalidQuery() {
|
public function testMakeAnInvalidQuery() {
|
||||||
|
@ -108,7 +115,7 @@ class TestDbDriverSQLite3 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testPrepareAValidQuery() {
|
public function testPrepareAValidQuery() {
|
||||||
$s = $this->drv->prepare("SELECT ?, ?", "int", "int");
|
$s = $this->drv->prepare("SELECT ?, ?", "int", "int");
|
||||||
$this->assertInstanceOf(Db\Statement::class, $s);
|
$this->assertInstanceOf(Statement::class, $s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrepareAnInvalidQuery() {
|
public function testPrepareAnInvalidQuery() {
|
|
@ -4,10 +4,12 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\Result;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Db\SQLite3\Result<extended> */
|
/** @covers \JKingWeb\Arsse\Db\SQLite3\Result<extended> */
|
||||||
class TestDbResultSQLite3 extends Test\AbstractTest {
|
class TestResult extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $c;
|
protected $c;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
|
@ -28,7 +30,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testConstructResult() {
|
public function testConstructResult() {
|
||||||
$set = $this->c->query("SELECT 1");
|
$set = $this->c->query("SELECT 1");
|
||||||
$this->assertInstanceOf(Db\Result::class, new Db\SQLite3\Result($set));
|
$this->assertInstanceOf(Result::class, new Result($set));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetChangeCountAndLastInsertId() {
|
public function testGetChangeCountAndLastInsertId() {
|
||||||
|
@ -36,7 +38,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
$set = $this->c->query("INSERT INTO test(col) values(1)");
|
$set = $this->c->query("INSERT INTO test(col) values(1)");
|
||||||
$rows = $this->c->changes();
|
$rows = $this->c->changes();
|
||||||
$id = $this->c->lastInsertRowID();
|
$id = $this->c->lastInsertRowID();
|
||||||
$r = new Db\SQLite3\Result($set, [$rows,$id]);
|
$r = new Result($set, [$rows,$id]);
|
||||||
$this->assertEquals($rows, $r->changes());
|
$this->assertEquals($rows, $r->changes());
|
||||||
$this->assertEquals($id, $r->lastId());
|
$this->assertEquals($id, $r->lastId());
|
||||||
}
|
}
|
||||||
|
@ -44,7 +46,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
public function testIterateOverResults() {
|
public function testIterateOverResults() {
|
||||||
$set = $this->c->query("SELECT 1 as col union select 2 as col union select 3 as col");
|
$set = $this->c->query("SELECT 1 as col union select 2 as col union select 3 as col");
|
||||||
$rows = [];
|
$rows = [];
|
||||||
foreach (new Db\SQLite3\Result($set) as $index => $row) {
|
foreach (new Result($set) as $index => $row) {
|
||||||
$rows[$index] = $row['col'];
|
$rows[$index] = $row['col'];
|
||||||
}
|
}
|
||||||
$this->assertEquals([0 => 1, 1 => 2, 2 => 3], $rows);
|
$this->assertEquals([0 => 1, 1 => 2, 2 => 3], $rows);
|
||||||
|
@ -53,7 +55,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
public function testIterateOverResultsTwice() {
|
public function testIterateOverResultsTwice() {
|
||||||
$set = $this->c->query("SELECT 1 as col union select 2 as col union select 3 as col");
|
$set = $this->c->query("SELECT 1 as col union select 2 as col union select 3 as col");
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$test = new Db\SQLite3\Result($set);
|
$test = new Result($set);
|
||||||
foreach ($test as $row) {
|
foreach ($test as $row) {
|
||||||
$rows[] = $row['col'];
|
$rows[] = $row['col'];
|
||||||
}
|
}
|
||||||
|
@ -66,7 +68,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testGetSingleValues() {
|
public function testGetSingleValues() {
|
||||||
$set = $this->c->query("SELECT 1867 as year union select 1970 as year union select 2112 as year");
|
$set = $this->c->query("SELECT 1867 as year union select 1970 as year union select 2112 as year");
|
||||||
$test = new Db\SQLite3\Result($set);
|
$test = new Result($set);
|
||||||
$this->assertEquals(1867, $test->getValue());
|
$this->assertEquals(1867, $test->getValue());
|
||||||
$this->assertEquals(1970, $test->getValue());
|
$this->assertEquals(1970, $test->getValue());
|
||||||
$this->assertEquals(2112, $test->getValue());
|
$this->assertEquals(2112, $test->getValue());
|
||||||
|
@ -75,7 +77,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testGetFirstValuesOnly() {
|
public function testGetFirstValuesOnly() {
|
||||||
$set = $this->c->query("SELECT 1867 as year, 19 as century union select 1970 as year, 20 as century union select 2112 as year, 22 as century");
|
$set = $this->c->query("SELECT 1867 as year, 19 as century union select 1970 as year, 20 as century union select 2112 as year, 22 as century");
|
||||||
$test = new Db\SQLite3\Result($set);
|
$test = new Result($set);
|
||||||
$this->assertEquals(1867, $test->getValue());
|
$this->assertEquals(1867, $test->getValue());
|
||||||
$this->assertEquals(1970, $test->getValue());
|
$this->assertEquals(1970, $test->getValue());
|
||||||
$this->assertEquals(2112, $test->getValue());
|
$this->assertEquals(2112, $test->getValue());
|
||||||
|
@ -88,7 +90,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
['album' => '2112', 'track' => '2112'],
|
['album' => '2112', 'track' => '2112'],
|
||||||
['album' => 'Clockwork Angels', 'track' => 'The Wreckers'],
|
['album' => 'Clockwork Angels', 'track' => 'The Wreckers'],
|
||||||
];
|
];
|
||||||
$test = new Db\SQLite3\Result($set);
|
$test = new Result($set);
|
||||||
$this->assertEquals($rows[0], $test->getRow());
|
$this->assertEquals($rows[0], $test->getRow());
|
||||||
$this->assertEquals($rows[1], $test->getRow());
|
$this->assertEquals($rows[1], $test->getRow());
|
||||||
$this->assertSame(null, $test->getRow());
|
$this->assertSame(null, $test->getRow());
|
||||||
|
@ -100,7 +102,7 @@ class TestDbResultSQLite3 extends Test\AbstractTest {
|
||||||
['album' => '2112', 'track' => '2112'],
|
['album' => '2112', 'track' => '2112'],
|
||||||
['album' => 'Clockwork Angels', 'track' => 'The Wreckers'],
|
['album' => 'Clockwork Angels', 'track' => 'The Wreckers'],
|
||||||
];
|
];
|
||||||
$test = new Db\SQLite3\Result($set);
|
$test = new Result($set);
|
||||||
$this->assertEquals($rows, $test->getAll());
|
$this->assertEquals($rows, $test->getAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,18 +4,18 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
|
||||||
|
|
||||||
use JKingWeb\Arsse\Db\Statement;
|
use JKingWeb\Arsse\Db\Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\Statement<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Statement<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbStatementSQLite3 extends Test\AbstractTest {
|
class TestStatement extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\Db\BindingTests;
|
use \JKingWeb\Arsse\Test\Db\BindingTests;
|
||||||
|
|
||||||
protected $c;
|
protected $c;
|
||||||
protected static $imp = Db\SQLite3\Statement::class;
|
protected static $imp = \JKingWeb\Arsse\Db\SQLite3\Statement::class;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
|
@ -48,7 +48,7 @@ class TestDbStatementSQLite3 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testConstructStatement() {
|
public function testConstructStatement() {
|
||||||
$nativeStatement = $this->c->prepare("SELECT ? as value");
|
$nativeStatement = $this->c->prepare("SELECT ? as value");
|
||||||
$this->assertInstanceOf(Statement::class, new Db\SQLite3\Statement($this->c, $nativeStatement));
|
$this->assertInstanceOf(Statement::class, new \JKingWeb\Arsse\Db\SQLite3\Statement($this->c, $nativeStatement));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBindMissingValue() {
|
public function testBindMissingValue() {
|
|
@ -4,14 +4,19 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Db\Exception;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
* @covers \JKingWeb\Arsse\Db\SQLite3\ExceptionBuilder */
|
||||||
class TestDbUpdateSQLite3 extends Test\AbstractTest {
|
class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
protected $vfs;
|
protected $vfs;
|
||||||
|
@ -29,12 +34,12 @@ class TestDbUpdateSQLite3 extends Test\AbstractTest {
|
||||||
if (!$conf) {
|
if (!$conf) {
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
}
|
}
|
||||||
$conf->dbDriver = Db\SQLite3\Driver::class;
|
$conf->dbDriver = Driver::class;
|
||||||
$conf->dbSQLite3File = ":memory:";
|
$conf->dbSQLite3File = ":memory:";
|
||||||
Arsse::$conf = $conf;
|
Arsse::$conf = $conf;
|
||||||
$this->base = $this->vfs->url();
|
$this->base = $this->vfs->url();
|
||||||
$this->path = $this->base."/SQLite3/";
|
$this->path = $this->base."/SQLite3/";
|
||||||
$this->drv = new Db\SQLite3\Driver();
|
$this->drv = new Driver();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown() {
|
public function tearDown() {
|
|
@ -1,18 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Db\ResultAggregate;
|
||||||
use JKingWeb\Arsse\Test\Result;
|
use JKingWeb\Arsse\Test\Result;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Db\ResultAggregate<extended> */
|
/** @covers \JKingWeb\Arsse\Db\ResultAggregate<extended> */
|
||||||
class TestResultAggregate extends Test\AbstractTest {
|
class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public function testGetChangeCountAndLastInsertId() {
|
public function testGetChangeCountAndLastInsertId() {
|
||||||
$in = [
|
$in = [
|
||||||
new Result([], 3, 4),
|
new Result([], 3, 4),
|
||||||
new Result([], 27, 10),
|
new Result([], 27, 10),
|
||||||
new Result([], 12, 2112),
|
new Result([], 12, 2112),
|
||||||
];
|
];
|
||||||
$r = new Db\ResultAggregate(...$in);
|
$r = new ResultAggregate(...$in);
|
||||||
$this->assertEquals(42, $r->changes());
|
$this->assertEquals(42, $r->changes());
|
||||||
$this->assertEquals(2112, $r->lastId());
|
$this->assertEquals(2112, $r->lastId());
|
||||||
}
|
}
|
||||||
|
@ -24,7 +25,7 @@ class TestResultAggregate extends Test\AbstractTest {
|
||||||
new Result([['col' => 3]]),
|
new Result([['col' => 3]]),
|
||||||
];
|
];
|
||||||
$rows = [];
|
$rows = [];
|
||||||
foreach (new Db\ResultAggregate(...$in) as $index => $row) {
|
foreach (new ResultAggregate(...$in) as $index => $row) {
|
||||||
$rows[$index] = $row['col'];
|
$rows[$index] = $row['col'];
|
||||||
}
|
}
|
||||||
$this->assertEquals([0 => 1, 1 => 2, 2 => 3], $rows);
|
$this->assertEquals([0 => 1, 1 => 2, 2 => 3], $rows);
|
||||||
|
@ -37,7 +38,7 @@ class TestResultAggregate extends Test\AbstractTest {
|
||||||
new Result([['col' => 3]]),
|
new Result([['col' => 3]]),
|
||||||
];
|
];
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$test = new Db\ResultAggregate(...$in);
|
$test = new ResultAggregate(...$in);
|
||||||
foreach ($test as $row) {
|
foreach ($test as $row) {
|
||||||
$rows[] = $row['col'];
|
$rows[] = $row['col'];
|
||||||
}
|
}
|
||||||
|
@ -49,7 +50,7 @@ class TestResultAggregate extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSingleValues() {
|
public function testGetSingleValues() {
|
||||||
$test = new Db\ResultAggregate(...[
|
$test = new ResultAggregate(...[
|
||||||
new Result([['year' => 1867]]),
|
new Result([['year' => 1867]]),
|
||||||
new Result([['year' => 1970]]),
|
new Result([['year' => 1970]]),
|
||||||
new Result([['year' => 2112]]),
|
new Result([['year' => 2112]]),
|
||||||
|
@ -61,7 +62,7 @@ class TestResultAggregate extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetFirstValuesOnly() {
|
public function testGetFirstValuesOnly() {
|
||||||
$test = new Db\ResultAggregate(...[
|
$test = new ResultAggregate(...[
|
||||||
new Result([['year' => 1867, 'century' => 19]]),
|
new Result([['year' => 1867, 'century' => 19]]),
|
||||||
new Result([['year' => 1970, 'century' => 20]]),
|
new Result([['year' => 1970, 'century' => 20]]),
|
||||||
new Result([['year' => 2112, 'century' => 22]]),
|
new Result([['year' => 2112, 'century' => 22]]),
|
||||||
|
@ -73,7 +74,7 @@ class TestResultAggregate extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRows() {
|
public function testGetRows() {
|
||||||
$test = new Db\ResultAggregate(...[
|
$test = new ResultAggregate(...[
|
||||||
new Result([['album' => '2112', 'track' => '2112']]),
|
new Result([['album' => '2112', 'track' => '2112']]),
|
||||||
new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]),
|
new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]),
|
||||||
]);
|
]);
|
||||||
|
@ -87,7 +88,7 @@ class TestResultAggregate extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAllRows() {
|
public function testGetAllRows() {
|
||||||
$test = new Db\ResultAggregate(...[
|
$test = new ResultAggregate(...[
|
||||||
new Result([['album' => '2112', 'track' => '2112']]),
|
new Result([['album' => '2112', 'track' => '2112']]),
|
||||||
new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]),
|
new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -1,35 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Db\ResultEmpty;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Db\ResultEmpty<extended> */
|
/** @covers \JKingWeb\Arsse\Db\ResultEmpty<extended> */
|
||||||
class TestResultEmpty extends Test\AbstractTest {
|
class TestResultEmpty extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public function testGetChangeCountAndLastInsertId() {
|
public function testGetChangeCountAndLastInsertId() {
|
||||||
$r = new Db\ResultEmpty;
|
$r = new ResultEmpty;
|
||||||
$this->assertEquals(0, $r->changes());
|
$this->assertEquals(0, $r->changes());
|
||||||
$this->assertEquals(0, $r->lastId());
|
$this->assertEquals(0, $r->lastId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIterateOverResults() {
|
public function testIterateOverResults() {
|
||||||
$rows = [];
|
$rows = [];
|
||||||
foreach (new Db\ResultEmpty as $index => $row) {
|
foreach (new ResultEmpty as $index => $row) {
|
||||||
$rows[$index] = $row['col'];
|
$rows[$index] = $row['col'];
|
||||||
}
|
}
|
||||||
$this->assertEquals([], $rows);
|
$this->assertEquals([], $rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSingleValues() {
|
public function testGetSingleValues() {
|
||||||
$test = new Db\ResultEmpty;
|
$test = new ResultEmpty;
|
||||||
$this->assertSame(null, $test->getValue());
|
$this->assertSame(null, $test->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetRows() {
|
public function testGetRows() {
|
||||||
$test = new Db\ResultEmpty;
|
$test = new ResultEmpty;
|
||||||
$this->assertSame(null, $test->getRow());
|
$this->assertSame(null, $test->getRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAllRows() {
|
public function testGetAllRows() {
|
||||||
$test = new Db\ResultEmpty;
|
$test = new ResultEmpty;
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$this->assertEquals($rows, $test->getAll());
|
$this->assertEquals($rows, $test->getAll());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,20 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Db;
|
||||||
|
|
||||||
use JKingWeb\Arsse\Db\Transaction;
|
use JKingWeb\Arsse\Db\Transaction;
|
||||||
|
use JKingWeb\Arsse\Db\Exception;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\Transaction */
|
* @covers \JKingWeb\Arsse\Db\Transaction */
|
||||||
class TestTransaction extends Test\AbstractTest {
|
class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $drv;
|
protected $drv;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
$drv = Phake::mock(Db\SQLite3\Driver::class);
|
$drv = Phake::mock(\JKingWeb\Arsse\Db\SQLite3\Driver::class);
|
||||||
Phake::when($drv)->savepointRelease->thenReturn(true);
|
Phake::when($drv)->savepointRelease->thenReturn(true);
|
||||||
Phake::when($drv)->savepointUndo->thenReturn(true);
|
Phake::when($drv)->savepointUndo->thenReturn(true);
|
||||||
Phake::when($drv)->savepointCreate->thenReturn(1)->thenReturn(2);
|
Phake::when($drv)->savepointCreate->thenReturn(1)->thenReturn(2);
|
||||||
|
@ -51,7 +52,7 @@ class TestTransaction extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIgnoreRollbackErrors() {
|
public function testIgnoreRollbackErrors() {
|
||||||
Phake::when($this->drv)->savepointUndo->thenThrow(new Db\Exception("savepointStale"));
|
Phake::when($this->drv)->savepointUndo->thenThrow(new Exception("savepointStale"));
|
||||||
$tr1 = new Transaction($this->drv);
|
$tr1 = new Transaction($this->drv);
|
||||||
$tr2 = new Transaction($this->drv);
|
$tr2 = new Transaction($this->drv);
|
||||||
unset($tr1, $tr2); // no exception should bubble up
|
unset($tr1, $tr2); // no exception should bubble up
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Exception;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Lang;
|
||||||
|
use JKingWeb\Arsse\Exception;
|
||||||
|
use JKingWeb\Arsse\Lang\Exception as LangException;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\AbstractException */
|
/** @covers \JKingWeb\Arsse\AbstractException */
|
||||||
class TestException extends Test\AbstractTest {
|
class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData(false);
|
$this->clearData(false);
|
||||||
// create a mock Lang object so as not to create a dependency loop
|
// create a mock Lang object so as not to create a dependency loop
|
||||||
|
@ -43,7 +47,7 @@ class TestException extends Test\AbstractTest {
|
||||||
*/
|
*/
|
||||||
public function testDerivedClass() {
|
public function testDerivedClass() {
|
||||||
$this->assertException("fileMissing", "Lang");
|
$this->assertException("fileMissing", "Lang");
|
||||||
throw new Lang\Exception("fileMissing");
|
throw new LangException("fileMissing");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +55,7 @@ class TestException extends Test\AbstractTest {
|
||||||
*/
|
*/
|
||||||
public function testDerivedClassWithMessageParameters() {
|
public function testDerivedClassWithMessageParameters() {
|
||||||
$this->assertException("fileMissing", "Lang");
|
$this->assertException("fileMissing", "Lang");
|
||||||
throw new Lang\Exception("fileMissing", "en");
|
throw new LangException("fileMissing", "en");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,6 +71,6 @@ class TestException extends Test\AbstractTest {
|
||||||
*/
|
*/
|
||||||
public function testDerivedClassWithMissingMessage() {
|
public function testDerivedClassWithMissingMessage() {
|
||||||
$this->assertException("uncoded");
|
$this->assertException("uncoded");
|
||||||
throw new Lang\Exception("testThisExceptionMessageDoesNotExist");
|
throw new LangException("testThisExceptionMessageDoesNotExist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,21 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Feed;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Feed;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
use JKingWeb\Arsse\Misc\Date;
|
use JKingWeb\Arsse\Misc\Date;
|
||||||
|
use JKingWeb\Arsse\Test\Result;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Feed
|
* @covers \JKingWeb\Arsse\Feed
|
||||||
* @covers \JKingWeb\Arsse\Feed\Exception
|
* @covers \JKingWeb\Arsse\Feed\Exception
|
||||||
* @group slow */
|
* @group slow */
|
||||||
class TestFeed extends Test\AbstractTest {
|
class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected static $host = "http://localhost:8000/";
|
protected static $host = "http://localhost:8000/";
|
||||||
protected $base = "";
|
protected $base = "";
|
||||||
protected $latest = [
|
protected $latest = [
|
||||||
|
@ -329,7 +334,7 @@ class TestFeed extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMatchLatestArticles() {
|
public function testMatchLatestArticles() {
|
||||||
Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Test\Result($this->latest));
|
Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Result($this->latest));
|
||||||
$f = new Feed(1, $this->base."Matching/1");
|
$f = new Feed(1, $this->base."Matching/1");
|
||||||
$this->assertCount(0, $f->newItems);
|
$this->assertCount(0, $f->newItems);
|
||||||
$this->assertCount(0, $f->changedItems);
|
$this->assertCount(0, $f->changedItems);
|
||||||
|
@ -345,8 +350,8 @@ class TestFeed extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMatchHistoricalArticles() {
|
public function testMatchHistoricalArticles() {
|
||||||
Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Test\Result($this->latest));
|
Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Result($this->latest));
|
||||||
Phake::when(Arsse::$db)->feedMatchIds(1, $this->anything(), $this->anything(), $this->anything(), $this->anything())->thenReturn(new Test\Result($this->others));
|
Phake::when(Arsse::$db)->feedMatchIds(1, $this->anything(), $this->anything(), $this->anything(), $this->anything())->thenReturn(new Result($this->others));
|
||||||
$f = new Feed(1, $this->base."Matching/5");
|
$f = new Feed(1, $this->base."Matching/5");
|
||||||
$this->assertCount(0, $f->newItems);
|
$this->assertCount(0, $f->newItems);
|
||||||
$this->assertCount(0, $f->changedItems);
|
$this->assertCount(0, $f->changedItems);
|
||||||
|
|
|
@ -4,14 +4,17 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Feed;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Feed;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Feed
|
* @covers \JKingWeb\Arsse\Feed
|
||||||
* @group slow */
|
* @group slow */
|
||||||
class TestFeedFetching extends Test\AbstractTest {
|
class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected static $host = "http://localhost:8000/";
|
protected static $host = "http://localhost:8000/";
|
||||||
protected $base = "";
|
protected $base = "";
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Lang;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Lang as TestClass;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Lang */
|
/** @covers \JKingWeb\Arsse\Lang */
|
||||||
class TestLang extends Test\AbstractTest {
|
class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\Lang\Setup;
|
use \JKingWeb\Arsse\Test\Lang\Setup;
|
||||||
|
|
||||||
public $files;
|
public $files;
|
||||||
public $path;
|
public $path;
|
||||||
|
@ -38,14 +40,14 @@ class TestLang extends Test\AbstractTest {
|
||||||
*/
|
*/
|
||||||
public function testLoadInternalStrings() {
|
public function testLoadInternalStrings() {
|
||||||
$this->assertEquals("", $this->l->set("", true));
|
$this->assertEquals("", $this->l->set("", true));
|
||||||
$this->assertCount(sizeof(Lang::REQUIRED), $this->l->dump());
|
$this->assertCount(sizeof(TestClass::REQUIRED), $this->l->dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @depends testLoadInternalStrings
|
* @depends testLoadInternalStrings
|
||||||
*/
|
*/
|
||||||
public function testLoadDefaultLanguage() {
|
public function testLoadDefaultLanguage() {
|
||||||
$this->assertEquals(Lang::DEFAULT, $this->l->set(Lang::DEFAULT, true));
|
$this->assertEquals(TestClass::DEFAULT, $this->l->set(TestClass::DEFAULT, true));
|
||||||
$str = $this->l->dump();
|
$str = $this->l->dump();
|
||||||
$this->assertArrayHasKey('Exception.JKingWeb/Arsse/Exception.uncoded', $str);
|
$this->assertArrayHasKey('Exception.JKingWeb/Arsse/Exception.uncoded', $str);
|
||||||
$this->assertArrayHasKey('Test.presentText', $str);
|
$this->assertArrayHasKey('Test.presentText', $str);
|
||||||
|
@ -55,7 +57,7 @@ class TestLang extends Test\AbstractTest {
|
||||||
* @depends testLoadDefaultLanguage
|
* @depends testLoadDefaultLanguage
|
||||||
*/
|
*/
|
||||||
public function testLoadSupplementaryLanguage() {
|
public function testLoadSupplementaryLanguage() {
|
||||||
$this->l->set(Lang::DEFAULT, true);
|
$this->l->set(TestClass::DEFAULT, true);
|
||||||
$this->assertEquals("ja", $this->l->set("ja", true));
|
$this->assertEquals("ja", $this->l->set("ja", true));
|
||||||
$str = $this->l->dump();
|
$str = $this->l->dump();
|
||||||
$this->assertArrayHasKey('Exception.JKingWeb/Arsse/Exception.uncoded', $str);
|
$this->assertArrayHasKey('Exception.JKingWeb/Arsse/Exception.uncoded', $str);
|
|
@ -4,13 +4,14 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Lang;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Lang as TestClass;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Lang */
|
/** @covers \JKingWeb\Arsse\Lang */
|
||||||
class TestLangErrors extends Test\AbstractTest {
|
class TestErrors extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\Lang\Setup;
|
use \JKingWeb\Arsse\Test\Lang\Setup;
|
||||||
|
|
||||||
public $files;
|
public $files;
|
||||||
public $path;
|
public $path;
|
||||||
|
@ -62,7 +63,7 @@ class TestLangErrors extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadMissingDefaultLanguage() {
|
public function testLoadMissingDefaultLanguage() {
|
||||||
unlink($this->path.Lang::DEFAULT.".php");
|
unlink($this->path.TestClass::DEFAULT.".php");
|
||||||
$this->assertException("defaultFileMissing", "Lang");
|
$this->assertException("defaultFileMissing", "Lang");
|
||||||
$this->l->set("fr", true);
|
$this->l->set("fr", true);
|
||||||
}
|
}
|
|
@ -4,20 +4,21 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Lang;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Lang as TestClass;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Lang */
|
/** @covers \JKingWeb\Arsse\Lang */
|
||||||
class TestLangComplex extends Test\AbstractTest {
|
class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\Lang\Setup;
|
use \JKingWeb\Arsse\Test\Lang\Setup;
|
||||||
|
|
||||||
public $files;
|
public $files;
|
||||||
public $path;
|
public $path;
|
||||||
public $l;
|
public $l;
|
||||||
|
|
||||||
public function setUpSeries() {
|
public function setUpSeries() {
|
||||||
$this->l->set(Lang::DEFAULT, true);
|
$this->l->set(TestClass::DEFAULT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLazyLoad() {
|
public function testLazyLoad() {
|
||||||
|
@ -68,7 +69,7 @@ class TestLangComplex extends Test\AbstractTest {
|
||||||
*/
|
*/
|
||||||
public function testFetchAMessageWithSingleNumericParameter() {
|
public function testFetchAMessageWithSingleNumericParameter() {
|
||||||
$this->l->set("en_ca", true);
|
$this->l->set("en_ca", true);
|
||||||
$this->assertEquals('Default language file "en" missing', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.defaultFileMissing', Lang::DEFAULT));
|
$this->assertEquals('Default language file "en" missing', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.defaultFileMissing', TestClass::DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -4,12 +4,12 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Misc;
|
||||||
|
|
||||||
use JKingWeb\Arsse\Misc\Context;
|
use JKingWeb\Arsse\Misc\Context;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Misc\Context */
|
/** @covers \JKingWeb\Arsse\Misc\Context */
|
||||||
class TestContext extends Test\AbstractTest {
|
class TestContext extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public function testVerifyInitialState() {
|
public function testVerifyInitialState() {
|
||||||
$c = new Context;
|
$c = new Context;
|
||||||
foreach ((new \ReflectionObject($c))->getMethods(\ReflectionMethod::IS_PUBLIC) as $m) {
|
foreach ((new \ReflectionObject($c))->getMethods(\ReflectionMethod::IS_PUBLIC) as $m) {
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Misc;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\ExceptionType;
|
||||||
use JKingWeb\Arsse\Misc\ValueInfo as I;
|
use JKingWeb\Arsse\Misc\ValueInfo as I;
|
||||||
use JKingWeb\Arsse\Test\Misc\StrClass;
|
use JKingWeb\Arsse\Test\Misc\StrClass;
|
||||||
|
use JKingWeb\Arsse\Test\Result;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Misc\ValueInfo */
|
/** @covers \JKingWeb\Arsse\Misc\ValueInfo */
|
||||||
class TestValueInfo extends Test\AbstractTest {
|
class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
}
|
}
|
||||||
|
@ -398,7 +400,7 @@ class TestValueInfo extends Test\AbstractTest {
|
||||||
[1e-6, [null,true], [true, false], [0, false], [1e-6, true], ["0.000001", true], [[1e-6], false]],
|
[1e-6, [null,true], [true, false], [0, false], [1e-6, true], ["0.000001", true], [[1e-6], false]],
|
||||||
[[1,2,3], [null,true], [true, false], [0, false], [0.0, false], ["", false], [[1,2,3], true] ],
|
[[1,2,3], [null,true], [true, false], [0, false], [0.0, false], ["", false], [[1,2,3], true] ],
|
||||||
[['a'=>1,'b'=>2], [null,true], [true, false], [0, false], [0.0, false], ["", false], [['a'=>1,'b'=>2], true] ],
|
[['a'=>1,'b'=>2], [null,true], [true, false], [0, false], [0.0, false], ["", false], [['a'=>1,'b'=>2], true] ],
|
||||||
[new Test\Result([['a'=>1,'b'=>2]]), [null,true], [true, false], [0, false], [0.0, false], ["", false], [[['a'=>1,'b'=>2]], true] ],
|
[new Result([['a'=>1,'b'=>2]]), [null,true], [true, false], [0, false], [0.0, false], ["", false], [[['a'=>1,'b'=>2]], true] ],
|
||||||
];
|
];
|
||||||
$params = [
|
$params = [
|
||||||
[I::T_MIXED, "Mixed" ],
|
[I::T_MIXED, "Mixed" ],
|
||||||
|
@ -496,8 +498,8 @@ class TestValueInfo extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
// Array-mode tests
|
// Array-mode tests
|
||||||
$tests = [
|
$tests = [
|
||||||
[I::T_INT | I::M_DROP, new Test\Result([1, 2, 2.2, 3]), [1,2,null,3] ],
|
[I::T_INT | I::M_DROP, new Result([1, 2, 2.2, 3]), [1,2,null,3] ],
|
||||||
[I::T_INT, new Test\Result([1, 2, 2.2, 3]), [1,2,2,3] ],
|
[I::T_INT, new Result([1, 2, 2.2, 3]), [1,2,2,3] ],
|
||||||
[I::T_STRING | I::M_STRICT, "Bare string", ["Bare string"]],
|
[I::T_STRING | I::M_STRICT, "Bare string", ["Bare string"]],
|
||||||
];
|
];
|
||||||
foreach ($tests as $index => $test) {
|
foreach ($tests as $index => $test) {
|
||||||
|
|
|
@ -4,8 +4,13 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\REST\NextCloudNews;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\User;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Service;
|
||||||
use JKingWeb\Arsse\REST\Request;
|
use JKingWeb\Arsse\REST\Request;
|
||||||
use JKingWeb\Arsse\REST\Response;
|
use JKingWeb\Arsse\REST\Response;
|
||||||
use JKingWeb\Arsse\Test\Result;
|
use JKingWeb\Arsse\Test\Result;
|
||||||
|
@ -13,10 +18,11 @@ use JKingWeb\Arsse\Misc\Date;
|
||||||
use JKingWeb\Arsse\Misc\Context;
|
use JKingWeb\Arsse\Misc\Context;
|
||||||
use JKingWeb\Arsse\Db\ExceptionInput;
|
use JKingWeb\Arsse\Db\ExceptionInput;
|
||||||
use JKingWeb\Arsse\Db\Transaction;
|
use JKingWeb\Arsse\Db\Transaction;
|
||||||
|
use JKingWeb\Arsse\REST\NextCloudNews\V1_2;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2<extended> */
|
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2<extended> */
|
||||||
class TestNCNV1_2 extends Test\AbstractTest {
|
class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $h;
|
protected $h;
|
||||||
protected $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler
|
protected $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler
|
||||||
'db' => [
|
'db' => [
|
||||||
|
@ -304,7 +310,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
|
||||||
// create a mock database interface
|
// create a mock database interface
|
||||||
Arsse::$db = Phake::mock(Database::class);
|
Arsse::$db = Phake::mock(Database::class);
|
||||||
Phake::when(Arsse::$db)->begin->thenReturn(Phake::mock(Transaction::class));
|
Phake::when(Arsse::$db)->begin->thenReturn(Phake::mock(Transaction::class));
|
||||||
$this->h = new REST\NextCloudNews\V1_2();
|
$this->h = new V1_2();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown() {
|
public function tearDown() {
|
||||||
|
@ -318,7 +324,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testSendAuthenticationChallenge() {
|
public function testSendAuthenticationChallenge() {
|
||||||
Phake::when(Arsse::$user)->authHTTP->thenReturn(false);
|
Phake::when(Arsse::$user)->authHTTP->thenReturn(false);
|
||||||
$exp = new Response(401, "", "", ['WWW-Authenticate: Basic realm="'.REST\NextCloudNews\V1_2::REALM.'"']);
|
$exp = new Response(401, "", "", ['WWW-Authenticate: Basic realm="'.V1_2::REALM.'"']);
|
||||||
$this->assertResponse($exp, $this->h->dispatch(new Request("GET", "/")));
|
$this->assertResponse($exp, $this->h->dispatch(new Request("GET", "/")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +502,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testRetrieveServerVersion() {
|
public function testRetrieveServerVersion() {
|
||||||
$exp = new Response(200, [
|
$exp = new Response(200, [
|
||||||
'version' => REST\NextCloudNews\V1_2::VERSION,
|
'version' => V1_2::VERSION,
|
||||||
'arsse_version' => Arsse::VERSION,
|
'arsse_version' => Arsse::VERSION,
|
||||||
]);
|
]);
|
||||||
$this->assertResponse($exp, $this->h->dispatch(new Request("GET", "/version")));
|
$this->assertResponse($exp, $this->h->dispatch(new Request("GET", "/version")));
|
||||||
|
@ -867,7 +873,7 @@ class TestNCNV1_2 extends Test\AbstractTest {
|
||||||
Phake::when(Arsse::$db)->metaGet("service_last_checkin")->thenReturn(Date::transform($valid, "sql"))->thenReturn(Date::transform($invalid, "sql"));
|
Phake::when(Arsse::$db)->metaGet("service_last_checkin")->thenReturn(Date::transform($valid, "sql"))->thenReturn(Date::transform($invalid, "sql"));
|
||||||
Phake::when(Arsse::$db)->driverCharsetAcceptable->thenReturn(true)->thenReturn(false);
|
Phake::when(Arsse::$db)->driverCharsetAcceptable->thenReturn(true)->thenReturn(false);
|
||||||
$arr1 = $arr2 = [
|
$arr1 = $arr2 = [
|
||||||
'version' => REST\NextCloudNews\V1_2::VERSION,
|
'version' => V1_2::VERSION,
|
||||||
'arsse_version' => Arsse::VERSION,
|
'arsse_version' => Arsse::VERSION,
|
||||||
'warnings' => [
|
'warnings' => [
|
||||||
'improperlyConfiguredCron' => false,
|
'improperlyConfiguredCron' => false,
|
|
@ -4,20 +4,21 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\REST\NextCloudNews;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\REST\NextCloudNews\Versions;
|
||||||
use JKingWeb\Arsse\REST\Request;
|
use JKingWeb\Arsse\REST\Request;
|
||||||
use JKingWeb\Arsse\REST\Response;
|
use JKingWeb\Arsse\REST\Response;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */
|
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */
|
||||||
class TestNCNVersionDiscovery extends Test\AbstractTest {
|
class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFetchVersionList() {
|
public function testFetchVersionList() {
|
||||||
$exp = new Response(200, ['apiLevels' => ['v1-2']]);
|
$exp = new Response(200, ['apiLevels' => ['v1-2']]);
|
||||||
$h = new REST\NextCloudNews\Versions();
|
$h = new Versions;
|
||||||
$req = new Request("GET", "/");
|
$req = new Request("GET", "/");
|
||||||
$res = $h->dispatch($req);
|
$res = $h->dispatch($req);
|
||||||
$this->assertEquals($exp, $res);
|
$this->assertEquals($exp, $res);
|
||||||
|
@ -31,7 +32,7 @@ class TestNCNVersionDiscovery extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testRespondToOptionsRequest() {
|
public function testRespondToOptionsRequest() {
|
||||||
$exp = new Response(204, "", "", ["Allow: HEAD,GET"]);
|
$exp = new Response(204, "", "", ["Allow: HEAD,GET"]);
|
||||||
$h = new REST\NextCloudNews\Versions();
|
$h = new Versions;
|
||||||
$req = new Request("OPTIONS", "/");
|
$req = new Request("OPTIONS", "/");
|
||||||
$res = $h->dispatch($req);
|
$res = $h->dispatch($req);
|
||||||
$this->assertEquals($exp, $res);
|
$this->assertEquals($exp, $res);
|
||||||
|
@ -39,7 +40,7 @@ class TestNCNVersionDiscovery extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testUseIncorrectMethod() {
|
public function testUseIncorrectMethod() {
|
||||||
$exp = new Response(405, "", "", ["Allow: HEAD,GET"]);
|
$exp = new Response(405, "", "", ["Allow: HEAD,GET"]);
|
||||||
$h = new REST\NextCloudNews\Versions();
|
$h = new Versions;
|
||||||
$req = new Request("POST", "/");
|
$req = new Request("POST", "/");
|
||||||
$res = $h->dispatch($req);
|
$res = $h->dispatch($req);
|
||||||
$this->assertEquals($exp, $res);
|
$this->assertEquals($exp, $res);
|
||||||
|
@ -47,7 +48,7 @@ class TestNCNVersionDiscovery extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testUseIncorrectPath() {
|
public function testUseIncorrectPath() {
|
||||||
$exp = new Response(404);
|
$exp = new Response(404);
|
||||||
$h = new REST\NextCloudNews\Versions();
|
$h = new Versions;
|
||||||
$req = new Request("GET", "/ook");
|
$req = new Request("GET", "/ook");
|
||||||
$res = $h->dispatch($req);
|
$res = $h->dispatch($req);
|
||||||
$this->assertEquals($exp, $res);
|
$this->assertEquals($exp, $res);
|
|
@ -4,8 +4,13 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\User;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Service;
|
||||||
use JKingWeb\Arsse\REST\Request;
|
use JKingWeb\Arsse\REST\Request;
|
||||||
use JKingWeb\Arsse\REST\Response;
|
use JKingWeb\Arsse\REST\Response;
|
||||||
use JKingWeb\Arsse\Test\Result;
|
use JKingWeb\Arsse\Test\Result;
|
||||||
|
@ -18,7 +23,7 @@ use Phake;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
|
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
|
||||||
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
|
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
|
||||||
class TestTinyTinyAPI extends Test\AbstractTest {
|
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $h;
|
protected $h;
|
||||||
protected $folders = [
|
protected $folders = [
|
||||||
['id' => 5, 'parent' => 3, 'children' => 0, 'feeds' => 1, 'name' => "Local"],
|
['id' => 5, 'parent' => 3, 'children' => 0, 'feeds' => 1, 'name' => "Local"],
|
||||||
|
@ -161,7 +166,7 @@ LONG_STRING;
|
||||||
'expires' => "2112-12-21 21:12:00",
|
'expires' => "2112-12-21 21:12:00",
|
||||||
'user' => Arsse::$user->id,
|
'user' => Arsse::$user->id,
|
||||||
]);
|
]);
|
||||||
$this->h = new REST\TinyTinyRSS\API();
|
$this->h = new API();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown() {
|
public function tearDown() {
|
|
@ -4,14 +4,19 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\User;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\REST\TinyTinyRSS\Icon;
|
||||||
use JKingWeb\Arsse\REST\Request;
|
use JKingWeb\Arsse\REST\Request;
|
||||||
use JKingWeb\Arsse\REST\Response;
|
use JKingWeb\Arsse\REST\Response;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Icon<extended> */
|
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Icon<extended> */
|
||||||
class TestTinyTinyIcon extends Test\AbstractTest {
|
class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $h;
|
protected $h;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
|
@ -20,7 +25,7 @@ class TestTinyTinyIcon extends Test\AbstractTest {
|
||||||
// create a mock user manager
|
// create a mock user manager
|
||||||
// create a mock database interface
|
// create a mock database interface
|
||||||
Arsse::$db = Phake::mock(Database::class);
|
Arsse::$db = Phake::mock(Database::class);
|
||||||
$this->h = new REST\TinyTinyRSS\Icon();
|
$this->h = new Icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown() {
|
public function tearDown() {
|
|
@ -4,13 +4,17 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\Service;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Service;
|
||||||
use JKingWeb\Arsse\Misc\Date;
|
use JKingWeb\Arsse\Misc\Date;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Service */
|
/** @covers \JKingWeb\Arsse\Service */
|
||||||
class TestService extends Test\AbstractTest {
|
class TestService extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $srv;
|
protected $srv;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
|
|
|
@ -4,42 +4,47 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\User;
|
||||||
|
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\User;
|
||||||
|
use JKingWeb\Arsse\User\Driver;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\User */
|
/** @covers \JKingWeb\Arsse\User */
|
||||||
class TestAuthorization extends Test\AbstractTest {
|
class TestAuthorization extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
const USERS = [
|
const USERS = [
|
||||||
'user@example.com' => User\Driver::RIGHTS_NONE,
|
'user@example.com' => Driver::RIGHTS_NONE,
|
||||||
'user@example.org' => User\Driver::RIGHTS_NONE,
|
'user@example.org' => Driver::RIGHTS_NONE,
|
||||||
'dman@example.com' => User\Driver::RIGHTS_DOMAIN_MANAGER,
|
'dman@example.com' => Driver::RIGHTS_DOMAIN_MANAGER,
|
||||||
'dman@example.org' => User\Driver::RIGHTS_DOMAIN_MANAGER,
|
'dman@example.org' => Driver::RIGHTS_DOMAIN_MANAGER,
|
||||||
'dadm@example.com' => User\Driver::RIGHTS_DOMAIN_ADMIN,
|
'dadm@example.com' => Driver::RIGHTS_DOMAIN_ADMIN,
|
||||||
'dadm@example.org' => User\Driver::RIGHTS_DOMAIN_ADMIN,
|
'dadm@example.org' => Driver::RIGHTS_DOMAIN_ADMIN,
|
||||||
'gman@example.com' => User\Driver::RIGHTS_GLOBAL_MANAGER,
|
'gman@example.com' => Driver::RIGHTS_GLOBAL_MANAGER,
|
||||||
'gman@example.org' => User\Driver::RIGHTS_GLOBAL_MANAGER,
|
'gman@example.org' => Driver::RIGHTS_GLOBAL_MANAGER,
|
||||||
'gadm@example.com' => User\Driver::RIGHTS_GLOBAL_ADMIN,
|
'gadm@example.com' => Driver::RIGHTS_GLOBAL_ADMIN,
|
||||||
'gadm@example.org' => User\Driver::RIGHTS_GLOBAL_ADMIN,
|
'gadm@example.org' => Driver::RIGHTS_GLOBAL_ADMIN,
|
||||||
// invalid rights levels
|
// invalid rights levels
|
||||||
'bad1@example.com' => User\Driver::RIGHTS_NONE+1,
|
'bad1@example.com' => Driver::RIGHTS_NONE+1,
|
||||||
'bad1@example.org' => User\Driver::RIGHTS_NONE+1,
|
'bad1@example.org' => Driver::RIGHTS_NONE+1,
|
||||||
'bad2@example.com' => User\Driver::RIGHTS_DOMAIN_MANAGER+1,
|
'bad2@example.com' => Driver::RIGHTS_DOMAIN_MANAGER+1,
|
||||||
'bad2@example.org' => User\Driver::RIGHTS_DOMAIN_MANAGER+1,
|
'bad2@example.org' => Driver::RIGHTS_DOMAIN_MANAGER+1,
|
||||||
'bad3@example.com' => User\Driver::RIGHTS_DOMAIN_ADMIN+1,
|
'bad3@example.com' => Driver::RIGHTS_DOMAIN_ADMIN+1,
|
||||||
'bad3@example.org' => User\Driver::RIGHTS_DOMAIN_ADMIN+1,
|
'bad3@example.org' => Driver::RIGHTS_DOMAIN_ADMIN+1,
|
||||||
'bad4@example.com' => User\Driver::RIGHTS_GLOBAL_MANAGER+1,
|
'bad4@example.com' => Driver::RIGHTS_GLOBAL_MANAGER+1,
|
||||||
'bad4@example.org' => User\Driver::RIGHTS_GLOBAL_MANAGER+1,
|
'bad4@example.org' => Driver::RIGHTS_GLOBAL_MANAGER+1,
|
||||||
'bad5@example.com' => User\Driver::RIGHTS_GLOBAL_ADMIN+1,
|
'bad5@example.com' => Driver::RIGHTS_GLOBAL_ADMIN+1,
|
||||||
'bad5@example.org' => User\Driver::RIGHTS_GLOBAL_ADMIN+1,
|
'bad5@example.org' => Driver::RIGHTS_GLOBAL_ADMIN+1,
|
||||||
|
|
||||||
];
|
];
|
||||||
const LEVELS = [
|
const LEVELS = [
|
||||||
User\Driver::RIGHTS_NONE,
|
Driver::RIGHTS_NONE,
|
||||||
User\Driver::RIGHTS_DOMAIN_MANAGER,
|
Driver::RIGHTS_DOMAIN_MANAGER,
|
||||||
User\Driver::RIGHTS_DOMAIN_ADMIN,
|
Driver::RIGHTS_DOMAIN_ADMIN,
|
||||||
User\Driver::RIGHTS_GLOBAL_MANAGER,
|
Driver::RIGHTS_GLOBAL_MANAGER,
|
||||||
User\Driver::RIGHTS_GLOBAL_ADMIN,
|
Driver::RIGHTS_GLOBAL_ADMIN,
|
||||||
];
|
];
|
||||||
const DOMAINS = [
|
const DOMAINS = [
|
||||||
'@example.com',
|
'@example.com',
|
||||||
|
@ -49,7 +54,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
protected $data;
|
protected $data;
|
||||||
|
|
||||||
public function setUp(string $drv = Test\User\DriverInternalMock::class, string $db = null) {
|
public function setUp(string $drv = \JkingWeb\Arsse\Test\User\DriverInternalMock::class, string $db = null) {
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
$conf->userDriver = $drv;
|
$conf->userDriver = $drv;
|
||||||
|
@ -91,7 +96,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testRegularUserLogic() {
|
public function testRegularUserLogic() {
|
||||||
foreach (self::USERS as $actor => $rights) {
|
foreach (self::USERS as $actor => $rights) {
|
||||||
if ($rights != User\Driver::RIGHTS_NONE) {
|
if ($rights != Driver::RIGHTS_NONE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Arsse::$user->auth($actor, "");
|
Arsse::$user->auth($actor, "");
|
||||||
|
@ -118,7 +123,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testDomainManagerLogic() {
|
public function testDomainManagerLogic() {
|
||||||
foreach (self::USERS as $actor => $actorRights) {
|
foreach (self::USERS as $actor => $actorRights) {
|
||||||
if ($actorRights != User\Driver::RIGHTS_DOMAIN_MANAGER) {
|
if ($actorRights != Driver::RIGHTS_DOMAIN_MANAGER) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$actorDomain = substr($actor, strrpos($actor, "@")+1);
|
$actorDomain = substr($actor, strrpos($actor, "@")+1);
|
||||||
|
@ -139,7 +144,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
// and they should only be able to set their own rights to regular user
|
// and they should only be able to set their own rights to regular user
|
||||||
foreach (self::LEVELS as $level) {
|
foreach (self::LEVELS as $level) {
|
||||||
if ($actor==$affected && in_array($level, [User\Driver::RIGHTS_NONE, User\Driver::RIGHTS_DOMAIN_MANAGER])) {
|
if ($actor==$affected && in_array($level, [User\Driver::RIGHTS_NONE, Driver::RIGHTS_DOMAIN_MANAGER])) {
|
||||||
$this->assertTrue(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted properly for $affected settings rights level $level, but the action was denied.");
|
$this->assertTrue(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted properly for $affected settings rights level $level, but the action was denied.");
|
||||||
} else {
|
} else {
|
||||||
$this->assertFalse(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted improperly for $affected settings rights level $level, but the action was allowed.");
|
$this->assertFalse(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted improperly for $affected settings rights level $level, but the action was allowed.");
|
||||||
|
@ -159,7 +164,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testDomainAdministratorLogic() {
|
public function testDomainAdministratorLogic() {
|
||||||
foreach (self::USERS as $actor => $actorRights) {
|
foreach (self::USERS as $actor => $actorRights) {
|
||||||
if ($actorRights != User\Driver::RIGHTS_DOMAIN_ADMIN) {
|
if ($actorRights != Driver::RIGHTS_DOMAIN_ADMIN) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$actorDomain = substr($actor, strrpos($actor, "@")+1);
|
$actorDomain = substr($actor, strrpos($actor, "@")+1);
|
||||||
|
@ -201,7 +206,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testGlobalManagerLogic() {
|
public function testGlobalManagerLogic() {
|
||||||
foreach (self::USERS as $actor => $actorRights) {
|
foreach (self::USERS as $actor => $actorRights) {
|
||||||
if ($actorRights != User\Driver::RIGHTS_GLOBAL_MANAGER) {
|
if ($actorRights != Driver::RIGHTS_GLOBAL_MANAGER) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$actorDomain = substr($actor, strrpos($actor, "@")+1);
|
$actorDomain = substr($actor, strrpos($actor, "@")+1);
|
||||||
|
@ -218,7 +223,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
// and they should only be able to set their own rights to regular user
|
// and they should only be able to set their own rights to regular user
|
||||||
foreach (self::LEVELS as $level) {
|
foreach (self::LEVELS as $level) {
|
||||||
if ($actor==$affected && in_array($level, [User\Driver::RIGHTS_NONE, User\Driver::RIGHTS_GLOBAL_MANAGER])) {
|
if ($actor==$affected && in_array($level, [User\Driver::RIGHTS_NONE, Driver::RIGHTS_GLOBAL_MANAGER])) {
|
||||||
$this->assertTrue(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted properly for $affected settings rights level $level, but the action was denied.");
|
$this->assertTrue(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted properly for $affected settings rights level $level, but the action was denied.");
|
||||||
} else {
|
} else {
|
||||||
$this->assertFalse(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted improperly for $affected settings rights level $level, but the action was allowed.");
|
$this->assertFalse(Arsse::$user->authorize($affected, "userRightsSet", $level), "User $actor acted improperly for $affected settings rights level $level, but the action was allowed.");
|
||||||
|
@ -234,7 +239,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testGlobalAdministratorLogic() {
|
public function testGlobalAdministratorLogic() {
|
||||||
foreach (self::USERS as $actor => $actorRights) {
|
foreach (self::USERS as $actor => $actorRights) {
|
||||||
if ($actorRights != User\Driver::RIGHTS_GLOBAL_ADMIN) {
|
if ($actorRights != Driver::RIGHTS_GLOBAL_ADMIN) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Arsse::$user->auth($actor, "");
|
Arsse::$user->auth($actor, "");
|
||||||
|
@ -302,7 +307,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
|
|
||||||
public function testExternalExceptionLogic() {
|
public function testExternalExceptionLogic() {
|
||||||
// set up the test for an external driver
|
// set up the test for an external driver
|
||||||
$this->setUp(Test\User\DriverExternalMock::class, Test\User\Database::class);
|
$this->setUp(\JKingWeb\Arsse\Test\User\DriverExternalMock::class, \JKingWeb\Arsse\Test\User\Database::class);
|
||||||
// run the previous test with the external driver set up
|
// run the previous test with the external driver set up
|
||||||
$this->testInternalExceptionLogic();
|
$this->testInternalExceptionLogic();
|
||||||
}
|
}
|
||||||
|
@ -318,7 +323,7 @@ class TestAuthorization extends Test\AbstractTest {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
call_user_func_array(array(Arsse::$user, $func), $args);
|
call_user_func_array(array(Arsse::$user, $func), $args);
|
||||||
} catch (User\ExceptionAuthz $e) {
|
} catch (\JKingWeb\Arsse\User\ExceptionAuthz $e) {
|
||||||
$err[] = $func;
|
$err[] = $func;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\User;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\User */
|
/** @covers \JKingWeb\Arsse\User */
|
||||||
class TestUserMockExternal extends Test\AbstractTest {
|
class TestMockExternal extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\User\CommonTests;
|
use \JKingWeb\Arsse\Test\User\CommonTests;
|
||||||
|
|
||||||
const USER1 = "john.doe@example.com";
|
const USER1 = "john.doe@example.com";
|
||||||
const USER2 = "jane.doe@example.com";
|
const USER2 = "jane.doe@example.com";
|
||||||
|
|
||||||
public $drv = Test\User\DriverExternalMock::class;
|
public $drv = \JKingWeb\Arsse\Test\User\DriverExternalMock::class;
|
||||||
}
|
}
|
|
@ -4,16 +4,18 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\User;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\User */
|
/** @covers \JKingWeb\Arsse\User */
|
||||||
class TestUserMockInternal extends Test\AbstractTest {
|
class TestMockInternal extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\User\CommonTests;
|
use \JKingWeb\Arsse\Test\User\CommonTests;
|
||||||
|
|
||||||
const USER1 = "john.doe@example.com";
|
const USER1 = "john.doe@example.com";
|
||||||
const USER2 = "jane.doe@example.com";
|
const USER2 = "jane.doe@example.com";
|
||||||
|
|
||||||
public $drv = Test\User\DriverInternalMock::class;
|
public $drv = \JKingWeb\Arsse\Test\User\DriverInternalMock::class;
|
||||||
|
|
||||||
public function setUpSeries() {
|
public function setUpSeries() {
|
||||||
Arsse::$db = null;
|
Arsse::$db = null;
|
|
@ -4,17 +4,17 @@
|
||||||
* See LICENSE and AUTHORS files for details */
|
* See LICENSE and AUTHORS files for details */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace JKingWeb\Arsse;
|
namespace JKingWeb\Arsse\TestCase\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\User
|
* @covers \JKingWeb\Arsse\User
|
||||||
* @covers \JKingWeb\Arsse\User\Internal\Driver
|
* @covers \JKingWeb\Arsse\User\Internal\Driver
|
||||||
* @covers \JKingWeb\Arsse\User\Internal\InternalFunctions */
|
* @covers \JKingWeb\Arsse\User\Internal\InternalFunctions */
|
||||||
class TestUserInternalDriver extends Test\AbstractTest {
|
class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
use Test\User\CommonTests;
|
use \JKingWeb\Arsse\Test\User\CommonTests;
|
||||||
|
|
||||||
const USER1 = "john.doe@example.com";
|
const USER1 = "john.doe@example.com";
|
||||||
const USER2 = "jane.doe@example.com";
|
const USER2 = "jane.doe@example.com";
|
||||||
|
|
||||||
public $drv = User\Internal\Driver::class;
|
public $drv = \JKingWeb\Arsse\User\Internal\Driver::class;
|
||||||
}
|
}
|
|
@ -21,9 +21,9 @@
|
||||||
<file>cases/Exception/TestException.php</file>
|
<file>cases/Exception/TestException.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Localization">
|
<testsuite name="Localization">
|
||||||
<file>cases/Lang/TestLang.php</file>
|
<file>cases/Lang/TestBasic.php</file>
|
||||||
<file>cases/Lang/TestLangComplex.php</file>
|
<file>cases/Lang/TestComplex.php</file>
|
||||||
<file>cases/Lang/TestLangErrors.php</file>
|
<file>cases/Lang/TestErrors.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Configuration">
|
<testsuite name="Configuration">
|
||||||
<file>cases/Conf/TestConf.php</file>
|
<file>cases/Conf/TestConf.php</file>
|
||||||
|
@ -33,24 +33,24 @@
|
||||||
<file>cases/Misc/TestContext.php</file>
|
<file>cases/Misc/TestContext.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="User management">
|
<testsuite name="User management">
|
||||||
<file>cases/User/TestUserMockInternal.php</file>
|
<file>cases/User/TestMockInternal.php</file>
|
||||||
<file>cases/User/TestUserMockExternal.php</file>
|
<file>cases/User/TestMockExternal.php</file>
|
||||||
<file>cases/User/TestUserInternalDriver.php</file>
|
<file>cases/User/TestInternal.php</file>
|
||||||
<file>cases/User/TestAuthorization.php</file>
|
<file>cases/User/TestAuthorization.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Feed parser">
|
<testsuite name="Feed parser">
|
||||||
<file>cases/Feed/TestFeedFetching.php</file>
|
<file>cases/Feed/TestFetching.php</file>
|
||||||
<file>cases/Feed/TestFeed.php</file>
|
<file>cases/Feed/TestFeed.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Database drivers">
|
<testsuite name="Database drivers">
|
||||||
<file>cases/Db/TestTransaction.php</file>
|
<file>cases/Db/TestTransaction.php</file>
|
||||||
<file>cases/Db/TestResultAggregate.php</file>
|
<file>cases/Db/TestResultAggregate.php</file>
|
||||||
<file>cases/Db/TestResultEmpty.php</file>
|
<file>cases/Db/TestResultEmpty.php</file>
|
||||||
<file>cases/Db/SQLite3/TestDbResultSQLite3.php</file>
|
<file>cases/Db/SQLite3/TestResult.php</file>
|
||||||
<file>cases/Db/SQLite3/TestDbStatementSQLite3.php</file>
|
<file>cases/Db/SQLite3/TestStatement.php</file>
|
||||||
<file>cases/Db/SQLite3/TestDbDriverCreationSQLite3.php</file>
|
<file>cases/Db/SQLite3/TestCreation.php</file>
|
||||||
<file>cases/Db/SQLite3/TestDbDriverSQLite3.php</file>
|
<file>cases/Db/SQLite3/TestDriver.php</file>
|
||||||
<file>cases/Db/SQLite3/TestDbUpdateSQLite3.php</file>
|
<file>cases/Db/SQLite3/TestUpdate.php</file>
|
||||||
|
|
||||||
<file>cases/Db/SQLite3PDO/TestDbResultSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestDbResultSQLite3PDO.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/TestDbStatementSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestDbStatementSQLite3PDO.php</file>
|
||||||
|
@ -59,16 +59,16 @@
|
||||||
<file>cases/Db/SQLite3PDO/TestDbUpdateSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestDbUpdateSQLite3PDO.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Database functions">
|
<testsuite name="Database functions">
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseMiscellanySQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestMiscellany.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseMetaSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestMeta.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseUserSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestUser.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseSessionSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestSession.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseFolderSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestFolder.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseFeedSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestFeed.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseSubscriptionSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestSubscription.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseArticleSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestArticle.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseLabelSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestLabel.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestDatabaseCleanupSQLite3.php</file>
|
<file>cases/Db/SQLite3/Database/TestCleanup.php</file>
|
||||||
|
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseMiscellanySQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestDatabaseMiscellanySQLite3PDO.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseUserSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestDatabaseUserSQLite3PDO.php</file>
|
||||||
|
@ -82,12 +82,12 @@
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Controllers">
|
<testsuite name="Controllers">
|
||||||
<testsuite name="NCNv1">
|
<testsuite name="NCNv1">
|
||||||
<file>cases/REST/NextCloudNews/TestNCNVersionDiscovery.php</file>
|
<file>cases/REST/NextCloudNews/TestVersions.php</file>
|
||||||
<file>cases/REST/NextCloudNews/TestNCNV1_2.php</file>
|
<file>cases/REST/NextCloudNews/TestV1_2.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="TTRSS">
|
<testsuite name="TTRSS">
|
||||||
<file>cases/REST/TinyTinyRSS/TestTinyTinyAPI.php</file>
|
<file>cases/REST/TinyTinyRSS/TestAPI.php</file>
|
||||||
<file>cases/REST/TinyTinyRSS/TestTinyTinyIcon.php</file>
|
<file>cases/REST/TinyTinyRSS/TestIcon.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Refresh service">
|
<testsuite name="Refresh service">
|
||||||
|
|
Loading…
Reference in a new issue