1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2025-01-03 14:32:40 +00:00

Simplify database cleanup between tests

This commit is contained in:
J. King 2018-12-10 13:17:04 -05:00
parent 8dbf237626
commit 73729a6be8
8 changed files with 30 additions and 25 deletions

View file

@ -49,14 +49,14 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest {
public function tearDown() {
// deconstruct the driver
unset($this->drv);
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
self::clearData();
}
public static function tearDownAfterClass() {
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
static::$interface = null;
static::$dbInfo = null;
self::clearData();

View file

@ -38,15 +38,15 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
self::clearData();
}
public static function tearDownAfterClass() {
static::$implementation = null;
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
static::$interface = null;
static::$dbInfo = null;
self::clearData();
}

View file

@ -39,15 +39,15 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
self::clearData();
}
public static function tearDownAfterClass() {
static::$implementation = null;
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
static::$interface = null;
static::$dbInfo = null;
self::clearData();
}

View file

@ -48,16 +48,16 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
public function tearDown() {
// deconstruct the driver
unset($this->drv);
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
unset($this->path, $this->base, $this->vfs);
self::clearData();
}
public static function tearDownAfterClass() {
static::$implementation = null;
if (static::$interface) {
// completely clear the database
(static::$dbInfo->razeFunction)(static::$interface);
}
static::$interface = null;
static::$dbInfo = null;
self::clearData();
}

View file

@ -25,9 +25,8 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
}
public static function tearDownAfterClass() {
if (static::$interface) {
static::$interface->close();
}
static::$interface->close();
static::$interface = null;
parent::tearDownAfterClass();
@unlink(static::$file);
static::$file = null;

View file

@ -17,9 +17,8 @@ class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
protected static $createTest = "CREATE TABLE arsse_test(id integer primary key)";
public static function tearDownAfterClass() {
if (static::$interface) {
static::$interface->close();
}
static::$interface->close();
static::$interface = null;
parent::tearDownAfterClass();
}

View file

@ -14,6 +14,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
public static function tearDownAfterClass() {
static::$interface->close();
static::$interface = null;
parent::tearDownAfterClass();
}

View file

@ -13,4 +13,10 @@ class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
protected static $implementation = "SQLite 3";
protected static $minimal1 = "create table arsse_meta(key text primary key not null, value text); pragma user_version=1";
protected static $minimal2 = "pragma user_version=2";
public static function tearDownAfterClass() {
static::$interface->close();
static::$interface = null;
parent::tearDownAfterClass();
}
}