summaryrefslogtreecommitdiff
path: root/tests/TestCase.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2018-12-31 10:40:02 +0000
committerGreg Roach <fisharebest@webtrees.net>2018-12-31 10:40:17 +0000
commit32f20c14b2839ce85ae9a14fd182d48b6c1989a6 (patch)
tree7fd18e1f041d8e1cece5215841fb8ebfacc52217 /tests/TestCase.php
parentbb5117adff0f725ce1bdc6855ad32979f8676035 (diff)
downloadwebtrees-32f20c14b2839ce85ae9a14fd182d48b6c1989a6.tar.gz
webtrees-32f20c14b2839ce85ae9a14fd182d48b6c1989a6.tar.bz2
webtrees-32f20c14b2839ce85ae9a14fd182d48b6c1989a6.zip
Add tests for Auth and Site classes
Diffstat (limited to 'tests/TestCase.php')
-rw-r--r--tests/TestCase.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 3fcfbc435b..159de5c94c 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -29,8 +29,6 @@ class TestCase extends \PHPUnit\Framework\TestCase
{
protected static $uses_database = false;
- protected static $uses_transactions = false;
-
/**
* Things to run once, before all the tests.
*/
@@ -38,11 +36,9 @@ class TestCase extends \PHPUnit\Framework\TestCase
{
parent::setUpBeforeClass();
- defined('WT_BASE_URL') || define('WT_BASE_URL', 'http://localhost/');
- defined('WT_ROOT') || define('WT_ROOT', dirname(__DIR__) . '/');
- defined('WT_DATA_DIR') || define('WT_DATA_DIR', WT_ROOT . 'data/');
-
if (static::$uses_database) {
+ defined('WT_ROOT') || define('WT_ROOT', dirname(__DIR__) . '/');
+
static::createTestDatabase();
}
}
@@ -54,7 +50,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
{
if (static::$uses_database) {
$pdo = DB::connection()->getPdo();
- $pdo = null;
+ unset($pdo);
}
parent::tearDownAfterClass();
@@ -67,8 +63,8 @@ class TestCase extends \PHPUnit\Framework\TestCase
{
parent::setUp();
- defined('WT_BASE_URL') || define('WT_BASE_URL', 'http://localhost/');
defined('WT_ROOT') || define('WT_ROOT', dirname(__DIR__) . '/');
+ defined('WT_BASE_URL') || define('WT_BASE_URL', 'http://localhost/');
defined('WT_DATA_DIR') || define('WT_DATA_DIR', WT_ROOT . 'data/');
defined('WT_LOCALE') || define('WT_LOCALE', I18N::init('en-US'));
@@ -82,9 +78,15 @@ class TestCase extends \PHPUnit\Framework\TestCase
*/
protected function tearDown()
{
- if (static::$uses_database && static::$uses_transactions) {
+ if (static::$uses_database) {
DB::connection()->rollBack();
}
+
+ Site::$preferences = [];
+ User::$cache = [];
+ Tree::$trees = [];
+
+ Auth::logout();
}
/**