Browse Source

switched back to origin TestCase structure

pull/5351/head
Philipp Holzer 3 years ago
parent
commit
8c2258dd2e
No known key found for this signature in database GPG Key ID: 58160D7D6AF942B6
4 changed files with 42 additions and 28 deletions
  1. +13
    -0
      tests/ApiTest.php
  2. +0
    -28
      tests/DatabaseTest.php
  3. +14
    -0
      tests/src/Core/Cache/CacheTest.php
  4. +15
    -0
      tests/src/Core/Lock/LockTest.php

+ 13
- 0
tests/ApiTest.php View File

@ -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');
}
/**


+ 0
- 28
tests/DatabaseTest.php View File

@ -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


+ 14
- 0
tests/src/Core/Cache/CacheTest.php View File

@ -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() {


+ 15
- 0
tests/src/Core/Lock/LockTest.php View File

@ -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…
Cancel
Save