1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Make data clearing in tests static

This commit is contained in:
J. King 2018-11-23 10:01:17 -05:00
parent 39110858b7
commit 7340d65c0e
57 changed files with 56 additions and 380 deletions

View file

@ -18,7 +18,7 @@ use Phake;
class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData(false);
self::clearData(false);
}
public function assertConsole(CLI $cli, string $command, int $exitStatus, string $output = "", bool $pattern = false) {

View file

@ -15,7 +15,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
public static $path;
public function setUp() {
$this->clearData();
self::clearData();
self::$vfs = vfsStream::setup("root", null, [
'confGood' => '<?php return Array("lang" => "xx");',
'confNotArray' => '<?php return 0;',
@ -35,7 +35,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
public function tearDown() {
self::$path = null;
self::$vfs = null;
$this->clearData();
self::clearData();
}
public function testLoadDefaultValues() {

View file

@ -11,7 +11,7 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Conf;
use JKingWeb\Arsse\User;
use JKingWeb\Arsse\Misc\ValueInfo;
use JKingWeb\Arsse\Test\Database;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Db\Result;
use Phake;
@ -23,12 +23,12 @@ abstract class Base {
public function setUp() {
// establish a clean baseline
$this->clearData();
self::clearData();
self::setConf();
// configure and create the relevant database driver
$this->setUpDriver();
// create the database interface with the suitable driver
Arsse::$db = new Database($this->drv);
Arsse::$db = new Database;
Arsse::$db->driverSchemaUpdate();
// create a mock user manager
Arsse::$user = Phake::mock(User::class);
@ -51,7 +51,7 @@ abstract class Base {
// clean up
$this->primed = false;
$this->drv = null;
$this->clearData();
self::clearData();
}
public function primeDatabase(array $data, \JKingWeb\Arsse\Db\Driver $drv = null): bool {

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Arsse;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use Phake;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Feed;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use Phake;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Misc\Context;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Test\Database;
use JKingWeb\Arsse\Arsse;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Database;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Misc\Date;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Test\Database;

View file

@ -4,7 +4,7 @@
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\Database;
namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\User\Driver as UserDriver;

View file

@ -22,7 +22,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest {
];
public function setUp() {
$this->clearData();
self::clearData();
self::setConf($this->conf);
$info = new DatabaseInformation($this->implementation);
$this->interface = ($info->interfaceConstructor)();
@ -37,7 +37,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
$this->clearData();
self::clearData();
unset($this->drv);
try {
$this->exec("ROLLBACK");

View file

@ -18,7 +18,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest {
abstract protected function makeResult(string $q): array;
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
$info = new DatabaseInformation($this->implementation);
$this->interface = ($info->interfaceConstructor)();
@ -31,7 +31,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
$this->clearData();
self::clearData();
$this->exec("DROP TABLE IF EXISTS arsse_meta");
}

View file

@ -19,7 +19,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
abstract protected function decorateTypeSyntax(string $value, string $type): string;
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
$info = new DatabaseInformation($this->implementation);
$this->interface = ($info->interfaceConstructor)();
@ -33,7 +33,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
public function tearDown() {
$this->exec("DROP TABLE IF EXISTS arsse_meta");
$this->clearData();
self::clearData();
}
public function testConstructStatement() {

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -24,7 +24,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
if (!Driver::requirementsMet()) {
$this->markTestSkipped("SQLite extension not loaded");
}
$this->clearData();
self::clearData();
// test files
$this->files = [
// cannot create files
@ -111,7 +111,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
$this->clearData();
self::clearData();
}
public function testFailToCreateDatabase() {

View file

@ -48,7 +48,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
}
public function provideDrivers() {
$this->clearData();
self::clearData();
self::setConf([
'dbTimeoutExec' => 0.5,
'dbSQLite3Timeout' => 0,

View file

@ -29,7 +29,7 @@ class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
if (!Driver::requirementsMet()) {
$this->markTestSkipped("SQLite extension not loaded");
}
$this->clearData();
self::clearData();
$this->vfs = vfsStream::setup("schemata", null, ['SQLite3' => []]);
self::setConf($conf);
$this->base = $this->vfs->url();
@ -41,7 +41,7 @@ class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
unset($this->drv);
unset($this->data);
unset($this->vfs);
$this->clearData();
self::clearData();
}
public function testLoadMissingFile() {

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -1,17 +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\TestCase\Db\SQLite3PDO\Database;
/**
* @covers \JKingWeb\Arsse\Database<extended>
* @covers \JKingWeb\Arsse\Misc\Query
*/
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;
}

View file

@ -25,7 +25,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
if (!Driver::requirementsMet()) {
$this->markTestSkipped("PDO-SQLite extension not loaded");
}
$this->clearData();
self::clearData();
// test files
$this->files = [
// cannot create files
@ -112,7 +112,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
$this->clearData();
self::clearData();
}
public function testFailToCreateDatabase() {

View file

@ -29,7 +29,7 @@ class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
if (!PDODriver::requirementsMet()) {
$this->markTestSkipped("PDO-SQLite extension not loaded");
}
$this->clearData();
self::clearData();
$this->vfs = vfsStream::setup("schemata", null, ['SQLite3' => []]);
$conf['dbDriver'] = PDODriver::class;
self::setConf($conf);
@ -42,7 +42,7 @@ class TestUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
unset($this->drv);
unset($this->data);
unset($this->vfs);
$this->clearData();
self::clearData();
}
public function testLoadMissingFile() {

View file

@ -16,7 +16,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest {
protected $drv;
public function setUp() {
$this->clearData();
self::clearData();
$drv = Phake::mock(\JKingWeb\Arsse\Db\SQLite3\Driver::class);
Phake::when($drv)->savepointRelease->thenReturn(true);
Phake::when($drv)->savepointUndo->thenReturn(true);

View file

@ -15,7 +15,7 @@ use Phake;
/** @covers \JKingWeb\Arsse\AbstractException */
class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData(false);
self::clearData(false);
// create a mock Lang object so as not to create a dependency loop
Arsse::$lang = Phake::mock(Lang::class);
Phake::when(Arsse::$lang)->msg->thenReturn("");
@ -26,7 +26,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
Phake::verify(Arsse::$lang, Phake::atLeast(0))->msg($this->isType("string"), $this->anything());
Phake::verifyNoOtherInteractions(Arsse::$lang);
// clean up
$this->clearData(true);
self::clearData(true);
}
public function testBaseClass() {

View file

@ -95,7 +95,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
$this->markTestSkipped("Test Web server is not accepting requests");
}
$this->base = self::$host."Feed/";
$this->clearData();
self::clearData();
self::setConf();
Arsse::$db = Phake::mock(Database::class);
}

View file

@ -25,7 +25,7 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest {
$this->markTestSkipped("Test Web server is not accepting requests");
}
$this->base = self::$host."Feed/";
$this->clearData();
self::clearData();
self::setConf();
}

View file

@ -11,7 +11,7 @@ use JKingWeb\Arsse\Misc\Date;
/** @covers \JKingWeb\Arsse\Misc\Date */
class TestDate extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData();
self::clearData();
}
public function testNormalizeADate() {

View file

@ -14,7 +14,7 @@ use JKingWeb\Arsse\Test\Result;
/** @covers \JKingWeb\Arsse\Misc\ValueInfo */
class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData();
self::clearData();
}
public function testGetIntegerInfo() {

View file

@ -339,7 +339,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
// create a mock user manager
Arsse::$user = Phake::mock(User::class);
@ -352,7 +352,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
$this->clearData();
self::clearData();
}
protected function v($value) {

View file

@ -15,7 +15,7 @@ use Zend\Diactoros\Response\EmptyResponse;
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */
class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData();
self::clearData();
}
protected function req(string $method, string $target): ResponseInterface {

View file

@ -176,7 +176,7 @@ LONG_STRING;
}
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
// create a mock user manager
Arsse::$user = Phake::mock(User::class);
@ -196,7 +196,7 @@ LONG_STRING;
}
public function tearDown() {
$this->clearData();
self::clearData();
}
public function testHandleInvalidPaths() {

View file

@ -23,7 +23,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest {
protected $user = "john.doe@example.com";
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
// create a mock user manager
Arsse::$user = Phake::mock(User::class);
@ -33,7 +33,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function tearDown() {
$this->clearData();
self::clearData();
}
protected function req(string $target, string $method = "GET", string $user = null): ResponseInterface {

View file

@ -18,7 +18,7 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest {
protected $srv;
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
Arsse::$db = Phake::mock(Database::class);
$this->srv = new Service();

View file

@ -19,7 +19,7 @@ use Phake;
class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
// create a mock database interface
Arsse::$db = Phake::mock(Database::class);

View file

@ -19,7 +19,7 @@ use Phake;
class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp() {
$this->clearData();
self::clearData();
self::setConf();
// create a mock database interface
Arsse::$db = Phake::mock(Database::class);

View file

@ -21,14 +21,14 @@ use Zend\Diactoros\Response\EmptyResponse;
/** @coversNothing */
abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
public function setUp() {
$this->clearData();
self::clearData();
}
public function tearDown() {
$this->clearData();
self::clearData();
}
public function clearData(bool $loadLang = true) {
public static function clearData(bool $loadLang = true) {
date_default_timezone_set("America/Toronto");
$r = new \ReflectionClass(\JKingWeb\Arsse\Arsse::class);
$props = array_keys($r->getStaticProperties());

View file

@ -21,7 +21,7 @@ trait Setup {
public function setUp() {
// establish a clean baseline
$this->clearData();
self::clearData();
self::setConf();
// configure and create the relevant database driver
$this->setUpDriver();
@ -49,7 +49,7 @@ trait Setup {
// clean up
$this->primed = false;
$this->drv = null;
$this->clearData();
self::clearData();
}
public function primeDatabase(array $data, \JKingWeb\Arsse\Db\Driver $drv = null): bool {

View file

@ -39,7 +39,7 @@ trait Setup {
// make the test Lang class use the vfs files
$this->l = new TestLang($this->path);
// create a mock Lang object so as not to create a dependency loop
$this->clearData(false);
self::clearData(false);
Arsse::$lang = Phake::mock(Lang::class);
Phake::when(Arsse::$lang)->msg->thenReturn("");
// call the additional setup method if it exists
@ -53,7 +53,7 @@ trait Setup {
Phake::verify(Arsse::$lang, Phake::atLeast(0))->msg($this->isType("string"), $this->anything());
Phake::verifyNoOtherInteractions(Arsse::$lang);
// clean up
$this->clearData(true);
self::clearData(true);
// call the additional teardiwn method if it exists
if (method_exists($this, "tearDownSeries")) {
$this->tearDownSeries();