switched back to origin TestCase structure
This commit is contained in:
parent
dbc38d4263
commit
8c2258dd2e
4 changed files with 42 additions and 28 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
namespace Friendica\Test;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Network\BadRequestException;
|
||||
|
@ -25,8 +26,13 @@ class ApiTest extends DatabaseTest
|
|||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $a;
|
||||
parent::setUp();
|
||||
|
||||
// Reusable App object
|
||||
$this->app = new App(__DIR__.'/../');
|
||||
$a = $this->app;
|
||||
|
||||
// User data that the test database is populated with
|
||||
$this->selfUser = [
|
||||
'id' => 42,
|
||||
|
@ -56,6 +62,13 @@ class ApiTest extends DatabaseTest
|
|||
'authenticated' => true,
|
||||
'uid' => $this->selfUser['id']
|
||||
];
|
||||
|
||||
// Default config
|
||||
Config::set('config', 'hostname', 'localhost');
|
||||
Config::set('system', 'throttle_limit_day', 100);
|
||||
Config::set('system', 'throttle_limit_week', 100);
|
||||
Config::set('system', 'throttle_limit_month', 100);
|
||||
Config::set('system', 'theme', 'system_theme');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
namespace Friendica\Test;
|
||||
|
||||
use dba;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBStructure;
|
||||
use PHPUnit_Extensions_Database_DB_IDatabaseConnection;
|
||||
use PHPUnit\DbUnit\DataSet\YamlDataSet;
|
||||
|
@ -19,35 +17,9 @@ use PHPUnit\Framework\TestCase;
|
|||
*/
|
||||
abstract class DatabaseTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Friendica\App
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
use TestCaseTrait;
|
||||
|
||||
/**
|
||||
* Creates basic instances for testing with databases
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $a;
|
||||
parent::setUp();
|
||||
|
||||
// Reusable App object
|
||||
$this->app = new App(__DIR__.'/../');
|
||||
$a = $this->app;
|
||||
|
||||
// Default config
|
||||
Config::set('config', 'hostname', 'localhost');
|
||||
Config::set('system', 'throttle_limit_day', 100);
|
||||
Config::set('system', 'throttle_limit_week', 100);
|
||||
Config::set('system', 'throttle_limit_month', 100);
|
||||
Config::set('system', 'theme', 'system_theme');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames an eventually existing .htconfig.php to .htconfig.php.tmp
|
||||
* Creates a new .htconfig.php for bin/worker.php execution
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -16,8 +18,20 @@ abstract class CacheTest extends DatabaseTest
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
global $a;
|
||||
parent::setUp();
|
||||
$this->instance = $this->getInstance();
|
||||
|
||||
// Reusable App object
|
||||
$this->app = new App(__DIR__.'/../');
|
||||
$a = $this->app;
|
||||
|
||||
// Default config
|
||||
Config::set('config', 'hostname', 'localhost');
|
||||
Config::set('system', 'throttle_limit_day', 100);
|
||||
Config::set('system', 'throttle_limit_week', 100);
|
||||
Config::set('system', 'throttle_limit_month', 100);
|
||||
Config::set('system', 'theme', 'system_theme');
|
||||
}
|
||||
|
||||
function testSimple() {
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class LockTest extends DatabaseTest
|
||||
{
|
||||
|
@ -15,8 +18,20 @@ abstract class LockTest extends DatabaseTest
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
global $a;
|
||||
parent::setUp();
|
||||
$this->instance = $this->getInstance();
|
||||
|
||||
// Reusable App object
|
||||
$this->app = new App(__DIR__.'/../');
|
||||
$a = $this->app;
|
||||
|
||||
// Default config
|
||||
Config::set('config', 'hostname', 'localhost');
|
||||
Config::set('system', 'throttle_limit_day', 100);
|
||||
Config::set('system', 'throttle_limit_week', 100);
|
||||
Config::set('system', 'throttle_limit_month', 100);
|
||||
Config::set('system', 'theme', 'system_theme');
|
||||
}
|
||||
|
||||
public function testLock() {
|
||||
|
|
Loading…
Reference in a new issue