mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-03 14:32:40 +00:00
Part 2
This commit is contained in:
parent
095fe10aec
commit
a5318d1b12
31 changed files with 207 additions and 207 deletions
|
@ -10,8 +10,8 @@ use JKingWeb\Arsse\Arsse;
|
||||||
use JKingWeb\Arsse\Conf;
|
use JKingWeb\Arsse\Conf;
|
||||||
use JKingWeb\Arsse\Database;
|
use JKingWeb\Arsse\Database;
|
||||||
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
use JKingWeb\Arsse\Db\SQLite3\Driver;
|
||||||
use JKingWeb\Arsse\Db\SQLite3\Result;
|
use JKingWeb\Arsse\Db\Result;
|
||||||
use JKingWeb\Arsse\Db\SQLite3\Statement;
|
use JKingWeb\Arsse\Db\Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\Driver<extended>
|
||||||
|
@ -22,7 +22,7 @@ class TestDriver extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $ch;
|
protected $ch;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
if (!Db\SQLite3\Driver::requirementsMet()) {
|
if (!Driver::requirementsMet()) {
|
||||||
$this->markTestSkipped("SQLite extension not loaded");
|
$this->markTestSkipped("SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
|
|
|
@ -13,10 +13,10 @@ class TestResult extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $c;
|
protected $c;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
if (!\JKingWeb\Arsse\Db\SQLite3\Driver::requirementsMet()) {
|
||||||
if (!Db\SQLite3\Driver::requirementsMet()) {
|
|
||||||
$this->markTestSkipped("SQLite extension not loaded");
|
$this->markTestSkipped("SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
|
$this->clearData();
|
||||||
$c = new \SQLite3(":memory:");
|
$c = new \SQLite3(":memory:");
|
||||||
$c->enableExceptions(true);
|
$c->enableExceptions(true);
|
||||||
$this->c = $c;
|
$this->c = $c;
|
||||||
|
|
|
@ -18,10 +18,10 @@ class TestStatement extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected static $imp = \JKingWeb\Arsse\Db\SQLite3\Statement::class;
|
protected static $imp = \JKingWeb\Arsse\Db\SQLite3\Statement::class;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
if (!\JKingWeb\Arsse\Db\SQLite3\Driver::requirementsMet()) {
|
||||||
if (!extension_loaded("sqlite3")) {
|
|
||||||
$this->markTestSkipped("SQLite extension not loaded");
|
$this->markTestSkipped("SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
|
$this->clearData();
|
||||||
$c = new \SQLite3(":memory:");
|
$c = new \SQLite3(":memory:");
|
||||||
$c->enableExceptions(true);
|
$c->enableExceptions(true);
|
||||||
$this->c = $c;
|
$this->c = $c;
|
||||||
|
|
|
@ -26,7 +26,7 @@ class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
const MINIMAL2 = "pragma user_version=2";
|
const MINIMAL2 = "pragma user_version=2";
|
||||||
|
|
||||||
public function setUp(Conf $conf = null) {
|
public function setUp(Conf $conf = null) {
|
||||||
if (!extension_loaded("sqlite3")) {
|
if (!Driver::requirementsMet()) {
|
||||||
$this->markTestSkipped("SQLite extension not loaded");
|
$this->markTestSkipped("SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
|
|
14
tests/cases/Db/SQLite3PDO/Database/TestArticle.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestArticle extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesArticle;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3PDO/Database/TestCleanup.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestCleanup extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesCleanup;
|
||||||
|
}
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseArticleSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesArticle;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseCleanupSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesCleanup;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseFeedSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesFeed;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseFolderSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesFolder;
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers \JKingWeb\Arsse\Database<extended>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseLabelSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesLabel;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseMetaSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesMeta;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseMiscellanySQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesMiscellany;
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace JKingWeb\Arsse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers \JKingWeb\Arsse\Database<extended>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseSessionSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesSession;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseSubscriptionSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesSubscription;
|
|
||||||
}
|
|
|
@ -1,16 +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>
|
|
||||||
* @group optional */
|
|
||||||
class TestDatabaseUserSQLite3PDO extends Test\AbstractTest {
|
|
||||||
use Test\Database\Setup;
|
|
||||||
use Test\Database\DriverSQLite3PDO;
|
|
||||||
use Test\Database\SeriesUser;
|
|
||||||
}
|
|
14
tests/cases/Db/SQLite3PDO/Database/TestFeed.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesFeed;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3PDO/Database/TestFolder.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestFolder extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesFolder;
|
||||||
|
}
|
10
tests/cases/Db/SQLite3PDO/Database/TestLabel.php
Normal file
10
tests/cases/Db/SQLite3PDO/Database/TestLabel.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestLabel extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesLabel;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3PDO/Database/TestMeta.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestMeta extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesMeta;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3PDO/Database/TestMiscellany.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestMiscellany extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesMiscellany;
|
||||||
|
}
|
10
tests/cases/Db/SQLite3PDO/Database/TestSession.php
Normal file
10
tests/cases/Db/SQLite3PDO/Database/TestSession.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestSession extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesSession;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3PDO/Database/TestSubscription.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestSubscription extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\SeriesSubscription;
|
||||||
|
}
|
14
tests/cases/Db/SQLite3PDO/Database/TestUser.php
Normal file
14
tests/cases/Db/SQLite3PDO/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\SQLite3PDO\Database;
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\Database<extended> */
|
||||||
|
class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
use \JKingWeb\Arsse\Test\Database\Setup;
|
||||||
|
use \JKingWeb\Arsse\Test\Database\DriverSQLite3PDO;
|
||||||
|
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\SQLite3PDO;
|
||||||
|
|
||||||
use JKingWeb\Arsse\Arsse;
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
use JKingWeb\Arsse\Db\SQLite3\PDODriver as Driver;
|
use JKingWeb\Arsse\Db\SQLite3\PDODriver as Driver;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
@ -15,7 +16,7 @@ use Phake;
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\PDODriver
|
* @covers \JKingWeb\Arsse\Db\PDODriver
|
||||||
* @covers \JKingWeb\Arsse\Db\PDOError */
|
* @covers \JKingWeb\Arsse\Db\PDOError */
|
||||||
class TestDbDriverCreationSQLite3PDO extends Test\AbstractTest {
|
class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
protected $ch;
|
protected $ch;
|
|
@ -4,28 +4,35 @@
|
||||||
* 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\SQLite3PDO;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\PDODriver;
|
||||||
|
use JKingWeb\Arsse\Db\Result;
|
||||||
|
use JKingWeb\Arsse\Db\Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\PDODriver
|
* @covers \JKingWeb\Arsse\Db\PDODriver
|
||||||
* @covers \JKingWeb\Arsse\Db\PDOError */
|
* @covers \JKingWeb\Arsse\Db\PDOError */
|
||||||
class TestDbDriverSQLite3PDO extends Test\AbstractTest {
|
class TestDriver extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
protected $ch;
|
protected $ch;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
if (!Db\SQLite3\PDODriver::requirementsMet()) {
|
if (!PDODriver::requirementsMet()) {
|
||||||
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
Arsse::$conf = $conf;
|
Arsse::$conf = $conf;
|
||||||
$conf->dbDriver = Db\SQLite3\PDODriver::class;
|
$conf->dbDriver = PDODriver::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\PDODriver();
|
$this->drv = new PDODriver();
|
||||||
$this->ch = new \PDO("sqlite:".Arsse::$conf->dbSQLite3File, "", "", [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
$this->ch = new \PDO("sqlite:".Arsse::$conf->dbSQLite3File, "", "", [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +87,7 @@ class TestDbDriverSQLite3PDO 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 TestDbDriverSQLite3PDO 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,17 +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\Db\SQLite3PDO;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Db\Result;
|
||||||
|
use JKingWeb\Arsse\Db\PDOResult;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\PDODriver;
|
||||||
|
|
||||||
/** @covers \JKingWeb\Arsse\Db\PDOResult<extended> */
|
/** @covers \JKingWeb\Arsse\Db\PDOResult<extended> */
|
||||||
class TestDbResultSQLite3PDO extends Test\AbstractTest {
|
class TestResult extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $c;
|
protected $c;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
if (!PDODriver::requirementsMet()) {
|
||||||
if (!Db\SQLite3\PDODriver::requirementsMet()) {
|
|
||||||
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
|
$this->clearData();
|
||||||
$c = new \PDO("sqlite::memory:", "", "", [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
$c = new \PDO("sqlite::memory:", "", "", [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
||||||
$this->c = $c;
|
$this->c = $c;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +30,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set));
|
$this->assertInstanceOf(Result::class, new PDOResult($set));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetChangeCountAndLastInsertId() {
|
public function testGetChangeCountAndLastInsertId() {
|
||||||
|
@ -34,7 +38,7 @@ class TestDbResultSQLite3PDO extends Test\AbstractTest {
|
||||||
$set = $this->c->query("INSERT INTO test(col) values(1)");
|
$set = $this->c->query("INSERT INTO test(col) values(1)");
|
||||||
$rows = $set->rowCount();
|
$rows = $set->rowCount();
|
||||||
$id = $this->c->lastInsertID();
|
$id = $this->c->lastInsertID();
|
||||||
$r = new Db\PDOResult($set, [$rows,$id]);
|
$r = new PDOResult($set, [$rows,$id]);
|
||||||
$this->assertSame((int) $rows, $r->changes());
|
$this->assertSame((int) $rows, $r->changes());
|
||||||
$this->assertSame((int) $id, $r->lastId());
|
$this->assertSame((int) $id, $r->lastId());
|
||||||
}
|
}
|
||||||
|
@ -42,7 +46,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set) as $index => $row) {
|
foreach (new PDOResult($set) as $index => $row) {
|
||||||
$rows[$index] = $row['col'];
|
$rows[$index] = $row['col'];
|
||||||
}
|
}
|
||||||
$this->assertSame([0 => "1", 1 => "2", 2 => "3"], $rows);
|
$this->assertSame([0 => "1", 1 => "2", 2 => "3"], $rows);
|
||||||
|
@ -51,7 +55,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set);
|
$test = new PDOResult($set);
|
||||||
foreach ($test as $row) {
|
foreach ($test as $row) {
|
||||||
$rows[] = $row['col'];
|
$rows[] = $row['col'];
|
||||||
}
|
}
|
||||||
|
@ -64,7 +68,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set);
|
$test = new PDOResult($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());
|
||||||
|
@ -73,7 +77,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set);
|
$test = new PDOResult($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());
|
||||||
|
@ -86,7 +90,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set);
|
$test = new PDOResult($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());
|
||||||
|
@ -98,7 +102,7 @@ class TestDbResultSQLite3PDO 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\PDOResult($set);
|
$test = new PDOResult($set);
|
||||||
$this->assertEquals($rows, $test->getAll());
|
$this->assertEquals($rows, $test->getAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,23 +4,25 @@
|
||||||
* 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\SQLite3PDO;
|
||||||
|
|
||||||
use JKingWeb\Arsse\Db\Statement;
|
use JKingWeb\Arsse\Db\Statement;
|
||||||
|
use JKingWeb\Arsse\Db\PDOStatement;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\PDODriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\PDOStatement<extended>
|
* @covers \JKingWeb\Arsse\Db\PDOStatement<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\PDOError */
|
* @covers \JKingWeb\Arsse\Db\PDOError */
|
||||||
class TestDbStatementSQLite3PDO extends Test\AbstractTest {
|
class TestStatement extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
|
||||||
protected $c;
|
protected $c;
|
||||||
protected static $imp = Db\PDOStatement::class;
|
protected static $imp = \JKingWeb\Arsse\Db\PDOStatement::class;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->clearData();
|
if (!PDODriver::requirementsMet()) {
|
||||||
if (!Db\SQLite3\PDODriver::requirementsMet()) {
|
|
||||||
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
|
$this->clearData();
|
||||||
$c = new \PDO("sqlite::memory:", "", "", [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
$c = new \PDO("sqlite::memory:", "", "", [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
||||||
$this->c = $c;
|
$this->c = $c;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +48,7 @@ class TestDbStatementSQLite3PDO 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\PDOStatement($this->c, $nativeStatement));
|
$this->assertInstanceOf(Statement::class, new PDOStatement($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\SQLite3PDO;
|
||||||
|
|
||||||
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
use JKingWeb\Arsse\Conf;
|
||||||
|
use JKingWeb\Arsse\Database;
|
||||||
|
use JKingWeb\Arsse\Db\Exception;
|
||||||
|
use JKingWeb\Arsse\Db\SQLite3\PDODriver;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
* @covers \JKingWeb\Arsse\Db\SQLite3\PDODriver<extended>
|
||||||
* @covers \JKingWeb\Arsse\Db\PDOError */
|
* @covers \JKingWeb\Arsse\Db\PDOError */
|
||||||
class TestDbUpdateSQLite3PDO extends Test\AbstractTest {
|
class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $drv;
|
protected $drv;
|
||||||
protected $vfs;
|
protected $vfs;
|
||||||
|
@ -21,7 +26,7 @@ class TestDbUpdateSQLite3PDO extends Test\AbstractTest {
|
||||||
const MINIMAL2 = "pragma user_version=2";
|
const MINIMAL2 = "pragma user_version=2";
|
||||||
|
|
||||||
public function setUp(Conf $conf = null) {
|
public function setUp(Conf $conf = null) {
|
||||||
if (!Db\SQLite3\PDODriver::requirementsMet()) {
|
if (!PDODriver::requirementsMet()) {
|
||||||
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
$this->markTestSkipped("PDO-SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
|
@ -29,12 +34,12 @@ class TestDbUpdateSQLite3PDO extends Test\AbstractTest {
|
||||||
if (!$conf) {
|
if (!$conf) {
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
}
|
}
|
||||||
$conf->dbDriver = Db\SQLite3\PDODriver::class;
|
$conf->dbDriver = PDODriver::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\PDODriver();
|
$this->drv = new PDODriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown() {
|
public function tearDown() {
|
|
@ -11,7 +11,7 @@ use JKingWeb\Arsse\Db\SQLite3\Driver;
|
||||||
|
|
||||||
trait DriverSQLite3 {
|
trait DriverSQLite3 {
|
||||||
public function setUpDriver() {
|
public function setUpDriver() {
|
||||||
if (!extension_loaded("sqlite3")) {
|
if (!Driver::requirementsMet()) {
|
||||||
$this->markTestSkipped("SQLite extension not loaded");
|
$this->markTestSkipped("SQLite extension not loaded");
|
||||||
}
|
}
|
||||||
Arsse::$conf->dbSQLite3File = ":memory:";
|
Arsse::$conf->dbSQLite3File = ":memory:";
|
||||||
|
|
|
@ -52,11 +52,11 @@
|
||||||
<file>cases/Db/SQLite3/TestDriver.php</file>
|
<file>cases/Db/SQLite3/TestDriver.php</file>
|
||||||
<file>cases/Db/SQLite3/TestUpdate.php</file>
|
<file>cases/Db/SQLite3/TestUpdate.php</file>
|
||||||
|
|
||||||
<file>cases/Db/SQLite3PDO/TestDbResultSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestResult.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/TestDbStatementSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestStatement.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/TestDbDriverCreationSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestCreation.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/TestDbDriverSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestDriver.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/TestDbUpdateSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/TestUpdate.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Database functions">
|
<testsuite name="Database functions">
|
||||||
<file>cases/Db/SQLite3/Database/TestMiscellany.php</file>
|
<file>cases/Db/SQLite3/Database/TestMiscellany.php</file>
|
||||||
|
@ -70,15 +70,16 @@
|
||||||
<file>cases/Db/SQLite3/Database/TestLabel.php</file>
|
<file>cases/Db/SQLite3/Database/TestLabel.php</file>
|
||||||
<file>cases/Db/SQLite3/Database/TestCleanup.php</file>
|
<file>cases/Db/SQLite3/Database/TestCleanup.php</file>
|
||||||
|
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseMiscellanySQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestMiscellany.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseUserSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestMeta.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseSessionSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestUser.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseFolderSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestSession.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseFeedSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestFolder.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseSubscriptionSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestFeed.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseArticleSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestSubscription.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseLabelSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestArticle.php</file>
|
||||||
<file>cases/Db/SQLite3PDO/Database/TestDatabaseCleanupSQLite3PDO.php</file>
|
<file>cases/Db/SQLite3PDO/Database/TestLabel.php</file>
|
||||||
|
<file>cases/Db/SQLite3PDO/Database/TestCleanup.php</file>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Controllers">
|
<testsuite name="Controllers">
|
||||||
<testsuite name="NCNv1">
|
<testsuite name="NCNv1">
|
||||||
|
|
Loading…
Reference in a new issue