diff --git a/phpunit.xml b/phpunit.xml index 0494b4dcb4..9ed293b631 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,5 +1,6 @@ diff --git a/src/App/Mode.php b/src/App/Mode.php index 10f1092a89..d9f5cdbd4c 100644 --- a/src/App/Mode.php +++ b/src/App/Mode.php @@ -87,10 +87,6 @@ class Mode */ public function has($mode) { - echo "mode: " . $this->mode . " with " . $mode; - - echo "value: " . ($this->mode & $mode); - return ($this->mode & $mode) > 0; } diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 941ed96bf8..cbc6f7e0b4 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -24,12 +24,11 @@ class ApiTest extends DatabaseTest /** * Create variables used by tests. */ - protected function setUp() + public function setUp() { parent::setUp(); - // Reusable App object - $this->app = BaseObject::getApp(); + require_once __DIR__.'/../include/api.php'; // User data that the test database is populated with $this->selfUser = [ diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index 9844699b06..52ca3f68d3 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -5,6 +5,8 @@ namespace Friendica\Test; +use Friendica\BaseObject; +use Friendica\Core\Config; use Friendica\Database\DBA; use PHPUnit\DbUnit\DataSet\YamlDataSet; use PHPUnit\DbUnit\TestCaseTrait; @@ -16,8 +18,15 @@ use PHPUnit_Extensions_Database_DB_IDatabaseConnection; */ abstract class DatabaseTest extends TestCase { + public function setUp() + { + // Reusable App object + $this->app = BaseObject::getApp(); - use TestCaseTrait; + Config::set('system', 'url', 'http://localhost'); + Config::set('system', 'hostname', 'localhost'); + Config::set('system', 'worker_dont_fork', true); + } /** * Get database connection. diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4bc3e932f0..ada2b1a0ec 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,20 +3,10 @@ * This file is loaded by PHPUnit before any test. */ -use Friendica\App; use PHPUnit\DbUnit\DataSet\YamlDataSet; use PHPUnit\DbUnit\TestCaseTrait; use PHPUnit\Framework\TestCase; -require_once __DIR__.'/../boot.php'; -require_once __DIR__.'/../include/api.php'; - -new App(dirname(__DIR__)); - -\Friendica\Core\Config::set('system', 'url', 'http://localhost'); -\Friendica\Core\Config::set('system', 'hostname', 'localhost'); -\Friendica\Core\Config::set('system', 'worker_dont_fork', true); - // Backward compatibility if (!class_exists(TestCase::class)) { class_alias(PHPUnit_Framework_TestCase::class, TestCase::class);