Merge branch 'rearange-testcases' into replace-app-with-apphelper-in-tests

This commit is contained in:
Art4 2024-12-15 22:03:06 +00:00
commit c24d36c02e
58 changed files with 160 additions and 170 deletions

View file

@ -5,13 +5,13 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Cache; namespace Friendica\Test;
use Friendica\Core\Cache\Capability\ICanCache; use Friendica\Core\Cache\Capability\ICanCache;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
use Friendica\Util\PidFile; use Friendica\Util\PidFile;
abstract class CacheTest extends MockedTestCase abstract class CacheTestCase extends MockedTestCase
{ {
/** /**
* @var int Start time of the mock (used for time operations) * @var int Start time of the mock (used for time operations)

View file

@ -5,13 +5,13 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Console; namespace Friendica\Test;
use Asika\SimpleConsole\Console; use Asika\SimpleConsole\Console;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
use Friendica\Test\Util\Intercept; use Friendica\Test\Util\Intercept;
abstract class ConsoleTest extends MockedTestCase abstract class ConsoleTestCase extends MockedTestCase
{ {
/** /**
* @var array The default argv for a Console Instance * @var array The default argv for a Console Instance

View file

@ -5,12 +5,12 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Lock; namespace Friendica\Test;
use Friendica\Core\Lock\Capability\ICanLock; use Friendica\Core\Lock\Capability\ICanLock;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
abstract class LockTest extends MockedTestCase abstract class LockTestCase extends MockedTestCase
{ {
/** /**
* @var int Start time of the mock (used for time operations) * @var int Start time of the mock (used for time operations)

View file

@ -5,7 +5,7 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Logger; namespace Friendica\Test;
trait LoggerDataTrait trait LoggerDataTrait
{ {

View file

@ -5,7 +5,7 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Logger; namespace Friendica\Test;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Logger\Util\Introspection; use Friendica\Core\Logger\Util\Introspection;
@ -14,7 +14,7 @@ use Mockery\MockInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
abstract class AbstractLoggerTest extends MockedTestCase abstract class LoggerTestCase extends MockedTestCase
{ {
use LoggerDataTrait; use LoggerDataTrait;

View file

@ -5,12 +5,12 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Cache; namespace Friendica\Test;
use Exception; use Exception;
use Friendica\Core\Cache\Capability\ICanCacheInMemory; use Friendica\Core\Cache\Capability\ICanCacheInMemory;
abstract class MemoryCacheTest extends CacheTest abstract class MemoryCacheTestCase extends CacheTestCase
{ {
/** /**
* @var \Friendica\Core\Cache\Capability\ICanCacheInMemory * @var \Friendica\Core\Cache\Capability\ICanCacheInMemory

View file

@ -5,17 +5,16 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\PConfig; namespace Friendica\Test;
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use Friendica\Core\PConfig\Type\AbstractPConfigValues; use Friendica\Core\PConfig\Type\AbstractPConfigValues;
use Friendica\Core\PConfig\Repository\PConfig as PConfigModel; use Friendica\Core\PConfig\Repository\PConfig as PConfigModel;
use Friendica\Core\PConfig\ValueObject\Cache; use Friendica\Core\PConfig\ValueObject\Cache;
use Friendica\Test\MockedTestCase;
use Mockery; use Mockery;
use Mockery\MockInterface; use Mockery\MockInterface;
abstract class PConfigTest extends MockedTestCase abstract class PConfigTestCase extends MockedTestCase
{ {
use ArraySubsetAsserts; use ArraySubsetAsserts;

View file

@ -5,12 +5,12 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Storage; namespace Friendica\Test;
use Friendica\Core\Storage\Capability\ICanConfigureStorage; use Friendica\Core\Storage\Capability\ICanConfigureStorage;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
abstract class StorageConfigTest extends MockedTestCase abstract class StorageConfigTestCase extends MockedTestCase
{ {
/** @return ICanConfigureStorage */ /** @return ICanConfigureStorage */
abstract protected function getInstance(); abstract protected function getInstance();

View file

@ -5,14 +5,14 @@
// //
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\Storage; namespace Friendica\Test;
use Friendica\Core\Storage\Capability\ICanReadFromStorage; use Friendica\Core\Storage\Capability\ICanReadFromStorage;
use Friendica\Core\Storage\Capability\ICanWriteToStorage; use Friendica\Core\Storage\Capability\ICanWriteToStorage;
use Friendica\Core\Storage\Exception\ReferenceStorageException; use Friendica\Core\Storage\Exception\ReferenceStorageException;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
abstract class StorageTest extends MockedTestCase abstract class StorageTestCase extends MockedTestCase
{ {
/** @return ICanWriteToStorage */ /** @return ICanWriteToStorage */
abstract protected function getInstance(); abstract protected function getInstance();

View file

@ -16,6 +16,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\DI; use Friendica\DI;
use Friendica\Test\ConsoleTestCase;
use Friendica\Test\Util\RendererMockTrait; use Friendica\Test\Util\RendererMockTrait;
use Friendica\Test\Util\VFSTrait; use Friendica\Test\Util\VFSTrait;
use Mockery; use Mockery;
@ -24,7 +25,7 @@ use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamFile; use org\bovigo\vfs\vfsStreamFile;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
class AutomaticInstallationConsoleTest extends ConsoleTest class AutomaticInstallationConsoleTest extends ConsoleTestCase
{ {
use VFSTrait; use VFSTrait;
use RendererMockTrait; use RendererMockTrait;
@ -273,7 +274,7 @@ Creating config file...
Checking database... Checking database...
[Error] -------- [Error] --------
Could not connect to database.: Could not connect to database.:
FIN; FIN;
@ -633,12 +634,12 @@ Options
-d|--dbdata <database> The name of the mysql/mariadb database (env MYSQL_DATABASE) -d|--dbdata <database> The name of the mysql/mariadb database (env MYSQL_DATABASE)
-U|--dbuser <username> The username of the mysql/mariadb database login (env MYSQL_USER or MYSQL_USERNAME) -U|--dbuser <username> The username of the mysql/mariadb database login (env MYSQL_USER or MYSQL_USERNAME)
-P|--dbpass <password> The password of the mysql/mariadb database login (env MYSQL_PASSWORD) -P|--dbpass <password> The password of the mysql/mariadb database login (env MYSQL_PASSWORD)
-U|--url <url> The full base URL of Friendica - f.e. 'https://friendica.local/sub' (env FRIENDICA_URL) -U|--url <url> The full base URL of Friendica - f.e. 'https://friendica.local/sub' (env FRIENDICA_URL)
-B|--phppath <php_path> The path of the PHP binary (env FRIENDICA_PHP_PATH) -B|--phppath <php_path> The path of the PHP binary (env FRIENDICA_PHP_PATH)
-b|--basepath <base_path> The basepath of Friendica (env FRIENDICA_BASE_PATH) -b|--basepath <base_path> The basepath of Friendica (env FRIENDICA_BASE_PATH)
-t|--tz <timezone> The timezone of Friendica (env FRIENDICA_TZ) -t|--tz <timezone> The timezone of Friendica (env FRIENDICA_TZ)
-L|--lang <language> The language of Friendica (env FRIENDICA_LANG) -L|--lang <language> The language of Friendica (env FRIENDICA_LANG)
Environment variables Environment variables
MYSQL_HOST The host of the mysql/mariadb database (mandatory if mysql and environment is used) MYSQL_HOST The host of the mysql/mariadb database (mandatory if mysql and environment is used)
MYSQL_PORT The port of the mysql/mariadb database MYSQL_PORT The port of the mysql/mariadb database
@ -651,7 +652,7 @@ Environment variables
FRIENDICA_ADMIN_MAIL The admin email address of Friendica (this email will be used for admin access) FRIENDICA_ADMIN_MAIL The admin email address of Friendica (this email will be used for admin access)
FRIENDICA_TZ The timezone of Friendica FRIENDICA_TZ The timezone of Friendica
FRIENDICA_LANG The langauge of Friendica FRIENDICA_LANG The langauge of Friendica
Examples Examples
bin/console autoinstall -f 'input.config.php bin/console autoinstall -f 'input.config.php
Installs Friendica with the prepared 'input.config.php' file Installs Friendica with the prepared 'input.config.php' file

View file

@ -11,11 +11,12 @@ use Friendica\App;
use Friendica\App\Mode; use Friendica\App\Mode;
use Friendica\Console\Config; use Friendica\Console\Config;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Test\ConsoleTestCase;
use Mockery; use Mockery;
use Mockery\LegacyMockInterface; use Mockery\LegacyMockInterface;
use Mockery\MockInterface; use Mockery\MockInterface;
class ConfigConsoleTest extends ConsoleTest class ConfigConsoleTest extends ConsoleTestCase
{ {
/** /**
* @var App\Mode|MockInterface $appMode * @var App\Mode|MockInterface $appMode

View file

@ -11,10 +11,11 @@ use Friendica\App;
use Friendica\App\Mode; use Friendica\App\Mode;
use Friendica\Console\Lock; use Friendica\Console\Lock;
use Friendica\Core\Lock\Capability\ICanLock; use Friendica\Core\Lock\Capability\ICanLock;
use Friendica\Test\ConsoleTestCase;
use Mockery; use Mockery;
use Mockery\MockInterface; use Mockery\MockInterface;
class LockConsoleTest extends ConsoleTest class LockConsoleTest extends ConsoleTestCase
{ {
/** /**
* @var App\Mode|MockInterface $appMode * @var App\Mode|MockInterface $appMode

View file

@ -9,10 +9,11 @@ namespace Friendica\Test\src\Console;
use Friendica\Console\ServerBlock; use Friendica\Console\ServerBlock;
use Friendica\Moderation\DomainPatternBlocklist; use Friendica\Moderation\DomainPatternBlocklist;
use Friendica\Test\ConsoleTestCase;
use Friendica\Test\FixtureTestTrait; use Friendica\Test\FixtureTestTrait;
use Mockery; use Mockery;
class ServerBlockConsoleTest extends ConsoleTest class ServerBlockConsoleTest extends ConsoleTestCase
{ {
use FixtureTestTrait; use FixtureTestTrait;

View file

@ -8,11 +8,12 @@
namespace Friendica\Test\src\Core\Cache; namespace Friendica\Test\src\Core\Cache;
use Friendica\Core\Cache\Type\APCuCache; use Friendica\Core\Cache\Type\APCuCache;
use Friendica\Test\MemoryCacheTestCase;
/** /**
* @group APCU * @group APCU
*/ */
class APCuCacheTest extends MemoryCacheTest class APCuCacheTest extends MemoryCacheTestCase
{ {
protected function setUp(): void protected function setUp(): void
{ {

View file

@ -8,8 +8,9 @@
namespace Friendica\Test\src\Core\Cache; namespace Friendica\Test\src\Core\Cache;
use Friendica\Core\Cache\Type\ArrayCache; use Friendica\Core\Cache\Type\ArrayCache;
use Friendica\Test\MemoryCacheTestCase;
class ArrayCacheTest extends MemoryCacheTest class ArrayCacheTest extends MemoryCacheTestCase
{ {
protected function getInstance() protected function getInstance()
{ {

View file

@ -7,13 +7,13 @@
namespace Friendica\Test\src\Core\Cache; namespace Friendica\Test\src\Core\Cache;
use Friendica\App\BaseURL; use Friendica\Core\Cache\Type\DatabaseCache;
use Friendica\Core\Cache; use Friendica\Test\CacheTestCase;
use Friendica\Test\DatabaseTestTrait; use Friendica\Test\DatabaseTestTrait;
use Friendica\Test\Util\CreateDatabaseTrait; use Friendica\Test\Util\CreateDatabaseTrait;
use Friendica\Test\Util\VFSTrait; use Friendica\Test\Util\VFSTrait;
class DatabaseCacheTest extends CacheTest class DatabaseCacheTest extends CacheTestCase
{ {
use DatabaseTestTrait; use DatabaseTestTrait;
use CreateDatabaseTrait; use CreateDatabaseTrait;
@ -30,7 +30,7 @@ class DatabaseCacheTest extends CacheTest
protected function getInstance() protected function getInstance()
{ {
$this->cache = new Cache\Type\DatabaseCache('database', $this->getDbInstance()); $this->cache = new DatabaseCache('database', $this->getDbInstance());
return $this->cache; return $this->cache;
} }

View file

@ -10,13 +10,14 @@ namespace Friendica\Test\src\Core\Cache;
use Exception; use Exception;
use Friendica\Core\Cache\Type\MemcacheCache; use Friendica\Core\Cache\Type\MemcacheCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Test\MemoryCacheTestCase;
use Mockery; use Mockery;
/** /**
* @requires extension memcache * @requires extension memcache
* @group MEMCACHE * @group MEMCACHE
*/ */
class MemcacheCacheTest extends MemoryCacheTest class MemcacheCacheTest extends MemoryCacheTestCase
{ {
protected function getInstance() protected function getInstance()
{ {

View file

@ -10,6 +10,7 @@ namespace Friendica\Test\src\Core\Cache;
use Exception; use Exception;
use Friendica\Core\Cache\Type\MemcachedCache; use Friendica\Core\Cache\Type\MemcachedCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Test\MemoryCacheTestCase;
use Mockery; use Mockery;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
@ -17,7 +18,7 @@ use Psr\Log\NullLogger;
* @requires extension memcached * @requires extension memcached
* @group MEMCACHED * @group MEMCACHED
*/ */
class MemcachedCacheTest extends MemoryCacheTest class MemcachedCacheTest extends MemoryCacheTestCase
{ {
protected function getInstance() protected function getInstance()
{ {

View file

@ -10,13 +10,14 @@ namespace Friendica\Test\src\Core\Cache;
use Exception; use Exception;
use Friendica\Core\Cache\Type\RedisCache; use Friendica\Core\Cache\Type\RedisCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Test\MemoryCacheTestCase;
use Mockery; use Mockery;
/** /**
* @requires extension redis * @requires extension redis
* @group REDIS * @group REDIS
*/ */
class RedisCacheTest extends MemoryCacheTest class RedisCacheTest extends MemoryCacheTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
@ -44,7 +45,7 @@ class RedisCacheTest extends MemoryCacheTest
->andReturn(null); ->andReturn(null);
try { try {
$this->cache = new \Friendica\Core\Cache\Type\RedisCache($host, $configMock); $this->cache = new RedisCache($host, $configMock);
} catch (Exception $e) { } catch (Exception $e) {
static::markTestSkipped('Redis is not available. Failure: ' . $e->getMessage()); static::markTestSkipped('Redis is not available. Failure: ' . $e->getMessage());
} }

View file

@ -10,9 +10,10 @@ namespace Friendica\Test\src\Core\KeyValueStorage;
use Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs; use Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs;
use Friendica\Core\KeyValueStorage\Type\DBKeyValueStorage; use Friendica\Core\KeyValueStorage\Type\DBKeyValueStorage;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Test\MockedTestCase;
use Friendica\Test\Util\CreateDatabaseTrait; use Friendica\Test\Util\CreateDatabaseTrait;
class DBKeyValueStorageTest extends KeyValueStorageTest class DBKeyValueStorageTest extends MockedTestCase
{ {
use CreateDatabaseTrait; use CreateDatabaseTrait;
@ -68,4 +69,79 @@ class DBKeyValueStorageTest extends KeyValueStorageTest
self::assertGreaterThanOrEqual($updateAt, $updateAtAfter); self::assertGreaterThanOrEqual($updateAt, $updateAtAfter);
} }
public function testInstance()
{
$instance = $this->getInstance();
self::assertInstanceOf(IManageKeyValuePairs::class, $instance);
}
public function dataTests(): array
{
return [
'string' => ['k' => 'data', 'v' => 'it'],
'boolTrue' => ['k' => 'data', 'v' => true],
'boolFalse' => ['k' => 'data', 'v' => false],
'integer' => ['k' => 'data', 'v' => 235],
'decimal' => ['k' => 'data', 'v' => 2.456],
'array' => ['k' => 'data', 'v' => ['1', 2, '3', true, false]],
'boolIntTrue' => ['k' => 'data', 'v' => 1],
'boolIntFalse' => ['k' => 'data', 'v' => 0],
];
}
/**
* @dataProvider dataTests
*/
public function testGetSetDelete($k, $v)
{
$instance = $this->getInstance();
$instance->set($k, $v);
self::assertEquals($v, $instance->get($k));
self::assertEquals($v, $instance[$k]);
$instance->delete($k);
self::assertNull($instance->get($k));
self::assertNull($instance[$k]);
}
/**
* @dataProvider dataTests
*/
public function testSetOverride($k, $v)
{
$instance = $this->getInstance();
$instance->set($k, $v);
self::assertEquals($v, $instance->get($k));
self::assertEquals($v, $instance[$k]);
$instance->set($k, 'another_value');
self::assertEquals('another_value', $instance->get($k));
self::assertEquals('another_value', $instance[$k]);
}
/**
* @dataProvider dataTests
*/
public function testOffsetSetDelete($k, $v)
{
$instance = $this->getInstance();
$instance[$k] = $v;
self::assertEquals($v, $instance->get($k));
self::assertEquals($v, $instance[$k]);
unset($instance[$k]);
self::assertNull($instance->get($k));
self::assertNull($instance[$k]);
}
} }

View file

@ -1,91 +0,0 @@
<?php
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Test\src\Core\KeyValueStorage;
use Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs;
use Friendica\Test\MockedTestCase;
abstract class KeyValueStorageTest extends MockedTestCase
{
abstract public function getInstance(): IManageKeyValuePairs;
public function testInstance()
{
$instance = $this->getInstance();
self::assertInstanceOf(IManageKeyValuePairs::class, $instance);
}
public function dataTests(): array
{
return [
'string' => ['k' => 'data', 'v' => 'it'],
'boolTrue' => ['k' => 'data', 'v' => true],
'boolFalse' => ['k' => 'data', 'v' => false],
'integer' => ['k' => 'data', 'v' => 235],
'decimal' => ['k' => 'data', 'v' => 2.456],
'array' => ['k' => 'data', 'v' => ['1', 2, '3', true, false]],
'boolIntTrue' => ['k' => 'data', 'v' => 1],
'boolIntFalse' => ['k' => 'data', 'v' => 0],
];
}
/**
* @dataProvider dataTests
*/
public function testGetSetDelete($k, $v)
{
$instance = $this->getInstance();
$instance->set($k, $v);
self::assertEquals($v, $instance->get($k));
self::assertEquals($v, $instance[$k]);
$instance->delete($k);
self::assertNull($instance->get($k));
self::assertNull($instance[$k]);
}
/**
* @dataProvider dataTests
*/
public function testSetOverride($k, $v)
{
$instance = $this->getInstance();
$instance->set($k, $v);
self::assertEquals($v, $instance->get($k));
self::assertEquals($v, $instance[$k]);
$instance->set($k, 'another_value');
self::assertEquals('another_value', $instance->get($k));
self::assertEquals('another_value', $instance[$k]);
}
/**
* @dataProvider dataTests
*/
public function testOffsetSetDelete($k, $v)
{
$instance = $this->getInstance();
$instance[$k] = $v;
self::assertEquals($v, $instance->get($k));
self::assertEquals($v, $instance[$k]);
unset($instance[$k]);
self::assertNull($instance->get($k));
self::assertNull($instance[$k]);
}
}

View file

@ -9,11 +9,12 @@ namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\Type\APCuCache; use Friendica\Core\Cache\Type\APCuCache;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
/** /**
* @group APCU * @group APCU
*/ */
class APCuCacheLockTest extends LockTest class APCuCacheLockTest extends LockTestCase
{ {
protected function setUp(): void protected function setUp(): void
{ {
@ -26,6 +27,6 @@ class APCuCacheLockTest extends LockTest
protected function getInstance() protected function getInstance()
{ {
return new \Friendica\Core\Lock\Type\CacheLock(new APCuCache('localhost')); return new CacheLock(new APCuCache('localhost'));
} }
} }

View file

@ -9,12 +9,13 @@ namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\Type\ArrayCache; use Friendica\Core\Cache\Type\ArrayCache;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
class ArrayCacheLockTest extends LockTest class ArrayCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
return new \Friendica\Core\Lock\Type\CacheLock(new ArrayCache('localhost')); return new CacheLock(new ArrayCache('localhost'));
} }
/** /**

View file

@ -8,9 +8,10 @@
namespace Friendica\Test\src\Core\Lock; namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Lock\Type\DatabaseLock; use Friendica\Core\Lock\Type\DatabaseLock;
use Friendica\Test\LockTestCase;
use Friendica\Test\Util\CreateDatabaseTrait; use Friendica\Test\Util\CreateDatabaseTrait;
class DatabaseLockDriverTest extends LockTest class DatabaseLockDriverTest extends LockTestCase
{ {
use CreateDatabaseTrait; use CreateDatabaseTrait;

View file

@ -11,13 +11,14 @@ use Exception;
use Friendica\Core\Cache\Type\MemcacheCache; use Friendica\Core\Cache\Type\MemcacheCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
/** /**
* @requires extension Memcache * @requires extension Memcache
* @group MEMCACHE * @group MEMCACHE
*/ */
class MemcacheCacheLockTest extends LockTest class MemcacheCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
@ -39,7 +40,7 @@ class MemcacheCacheLockTest extends LockTest
try { try {
$cache = new MemcacheCache($host, $configMock); $cache = new MemcacheCache($host, $configMock);
$lock = new \Friendica\Core\Lock\Type\CacheLock($cache); $lock = new CacheLock($cache);
} catch (Exception $e) { } catch (Exception $e) {
static::markTestSkipped('Memcache is not available'); static::markTestSkipped('Memcache is not available');
} }

View file

@ -11,6 +11,7 @@ use Exception;
use Friendica\Core\Cache\Type\MemcachedCache; use Friendica\Core\Cache\Type\MemcachedCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
@ -18,7 +19,7 @@ use Psr\Log\NullLogger;
* @requires extension memcached * @requires extension memcached
* @group MEMCACHED * @group MEMCACHED
*/ */
class MemcachedCacheLockTest extends LockTest class MemcachedCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {

View file

@ -11,13 +11,14 @@ use Exception;
use Friendica\Core\Cache\Type\RedisCache; use Friendica\Core\Cache\Type\RedisCache;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Lock\Type\CacheLock; use Friendica\Core\Lock\Type\CacheLock;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
/** /**
* @requires extension redis * @requires extension redis
* @group REDIS * @group REDIS
*/ */
class RedisCacheLockTest extends LockTest class RedisCacheLockTest extends LockTestCase
{ {
protected function getInstance() protected function getInstance()
{ {
@ -48,7 +49,7 @@ class RedisCacheLockTest extends LockTest
try { try {
$cache = new RedisCache($host, $configMock); $cache = new RedisCache($host, $configMock);
$lock = new \Friendica\Core\Lock\Type\CacheLock($cache); $lock = new CacheLock($cache);
} catch (Exception $e) { } catch (Exception $e) {
static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage()); static::markTestSkipped('Redis is not available. Error: ' . $e->getMessage());
} }

View file

@ -12,12 +12,14 @@ use Friendica\App;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Config\Model\ReadOnlyFileConfig; use Friendica\Core\Config\Model\ReadOnlyFileConfig;
use Friendica\Core\Config\ValueObject\Cache; use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Lock\Type\SemaphoreLock;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Test\LockTestCase;
use Mockery; use Mockery;
use Mockery\MockInterface; use Mockery\MockInterface;
class SemaphoreLockTest extends LockTest class SemaphoreLockTest extends LockTestCase
{ {
protected function setUp(): void protected function setUp(): void
{ {
@ -40,7 +42,7 @@ class SemaphoreLockTest extends LockTest
protected function getInstance() protected function getInstance()
{ {
return new \Friendica\Core\Lock\Type\SemaphoreLock(); return new SemaphoreLock();
} }
/** /**

View file

@ -8,6 +8,7 @@
namespace Friendica\Test\src\Core\Logger; namespace Friendica\Test\src\Core\Logger;
use Friendica\Core\Logger\Type\ProfilerLogger; use Friendica\Core\Logger\Type\ProfilerLogger;
use Friendica\Test\LoggerDataTrait;
use Friendica\Test\MockedTestCase; use Friendica\Test\MockedTestCase;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
use Mockery\MockInterface; use Mockery\MockInterface;

View file

@ -9,13 +9,14 @@ namespace Friendica\Test\src\Core\Logger;
use Friendica\Core\Logger\Exception\LoggerArgumentException; use Friendica\Core\Logger\Exception\LoggerArgumentException;
use Friendica\Core\Logger\Exception\LogLevelException; use Friendica\Core\Logger\Exception\LogLevelException;
use Friendica\Test\LoggerTestCase;
use Friendica\Test\Util\VFSTrait; use Friendica\Test\Util\VFSTrait;
use Friendica\Core\Logger\Type\StreamLogger; use Friendica\Core\Logger\Type\StreamLogger;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamFile; use org\bovigo\vfs\vfsStreamFile;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
class StreamLoggerTest extends AbstractLoggerTest class StreamLoggerTest extends LoggerTestCase
{ {
use VFSTrait; use VFSTrait;

View file

@ -9,9 +9,10 @@ namespace Friendica\Test\src\Core\Logger;
use Friendica\Core\Logger\Exception\LogLevelException; use Friendica\Core\Logger\Exception\LogLevelException;
use Friendica\Core\Logger\Type\SyslogLogger; use Friendica\Core\Logger\Type\SyslogLogger;
use Friendica\Test\LoggerTestCase;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
class SyslogLoggerTest extends AbstractLoggerTest class SyslogLoggerTest extends LoggerTestCase
{ {
/** /**
* @var SyslogLoggerWrapper * @var SyslogLoggerWrapper

View file

@ -8,8 +8,9 @@
namespace Friendica\Test\src\Core\PConfig; namespace Friendica\Test\src\Core\PConfig;
use Friendica\Core\PConfig\Type\JitPConfig; use Friendica\Core\PConfig\Type\JitPConfig;
use Friendica\Test\PConfigTestCase;
class JitPConfigTest extends PConfigTest class JitPConfigTest extends PConfigTestCase
{ {
public function getInstance() public function getInstance()
{ {

View file

@ -8,12 +8,13 @@
namespace Friendica\Test\src\Core\PConfig; namespace Friendica\Test\src\Core\PConfig;
use Friendica\Core\PConfig\Type\PreloadPConfig; use Friendica\Core\PConfig\Type\PreloadPConfig;
use Friendica\Test\PConfigTestCase;
class PreloadPConfigTest extends PConfigTest class PreloadPConfigTest extends PConfigTestCase
{ {
public function getInstance() public function getInstance()
{ {
return new \Friendica\Core\PConfig\Type\PreloadPConfig($this->configCache, $this->configModel); return new PreloadPConfig($this->configCache, $this->configModel);
} }
/** /**

View file

@ -8,9 +8,10 @@
namespace Friendica\Test\src\Core\Storage; namespace Friendica\Test\src\Core\Storage;
use Friendica\Core\Storage\Type\Database; use Friendica\Core\Storage\Type\Database;
use Friendica\Test\StorageTestCase;
use Friendica\Test\Util\CreateDatabaseTrait; use Friendica\Test\Util\CreateDatabaseTrait;
class DatabaseStorageTest extends StorageTest class DatabaseStorageTest extends StorageTestCase
{ {
use CreateDatabaseTrait; use CreateDatabaseTrait;

View file

@ -11,11 +11,12 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Storage\Capability\ICanConfigureStorage; use Friendica\Core\Storage\Capability\ICanConfigureStorage;
use Friendica\Core\Storage\Type\FilesystemConfig; use Friendica\Core\Storage\Type\FilesystemConfig;
use Friendica\Test\StorageConfigTestCase;
use Friendica\Test\Util\VFSTrait; use Friendica\Test\Util\VFSTrait;
use Mockery\MockInterface; use Mockery\MockInterface;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
class FilesystemStorageConfigTest extends StorageConfigTest class FilesystemStorageConfigTest extends StorageConfigTestCase
{ {
use VFSTrait; use VFSTrait;

View file

@ -10,10 +10,11 @@ namespace Friendica\Test\src\Core\Storage;
use Friendica\Core\Storage\Exception\StorageException; use Friendica\Core\Storage\Exception\StorageException;
use Friendica\Core\Storage\Type\Filesystem; use Friendica\Core\Storage\Type\Filesystem;
use Friendica\Core\Storage\Type\FilesystemConfig; use Friendica\Core\Storage\Type\FilesystemConfig;
use Friendica\Test\StorageTestCase;
use Friendica\Test\Util\VFSTrait; use Friendica\Test\Util\VFSTrait;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
class FilesystemStorageTest extends StorageTest class FilesystemStorageTest extends StorageTestCase
{ {
use VFSTrait; use VFSTrait;

View file

@ -9,8 +9,8 @@ namespace Friendica\Test\src\Factory\Api\Twitter;
use Friendica\DI; use Friendica\DI;
use Friendica\Factory\Api\Twitter\DirectMessage; use Friendica\Factory\Api\Twitter\DirectMessage;
use Friendica\Test\FixtureTestCase;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;
use Friendica\Test\FixtureTestCase;
class DirectMessageTest extends FixtureTestCase class DirectMessageTest extends FixtureTestCase
{ {

View file

@ -16,8 +16,8 @@ use Friendica\Factory\Api\Twitter\Media;
use Friendica\Factory\Api\Twitter\Mention; use Friendica\Factory\Api\Twitter\Mention;
use Friendica\Factory\Api\Twitter\Status; use Friendica\Factory\Api\Twitter\Status;
use Friendica\Factory\Api\Twitter\Url; use Friendica\Factory\Api\Twitter\Url;
use Friendica\Test\FixtureTestCase;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;
use Friendica\Test\FixtureTestCase;
class StatusTest extends FixtureTestCase class StatusTest extends FixtureTestCase
{ {

View file

@ -10,8 +10,8 @@ namespace Friendica\Test\src\Factory\Api\Twitter;
use Friendica\DI; use Friendica\DI;
use Friendica\Factory\Api\Twitter\User; use Friendica\Factory\Api\Twitter\User;
use Friendica\Network\HTTPException\NotFoundException; use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Test\FixtureTestCase;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;
use Friendica\Test\FixtureTestCase;
class UserTest extends FixtureTestCase class UserTest extends FixtureTestCase
{ {

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Friendica\DirectMessages; namespace Friendica\Test\src\Module\Api\Friendica\DirectMessages;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Factory\Api\Twitter\DirectMessage; use Friendica\Factory\Api\Twitter\DirectMessage;
use Friendica\Module\Api\Friendica\DirectMessages\Search; use Friendica\Module\Api\Friendica\DirectMessages\Search;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Mastodon\Accounts; namespace Friendica\Test\src\Module\Api\Mastodon\Accounts;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Mastodon\Accounts\VerifyCredentials; use Friendica\Module\Api\Mastodon\Accounts\VerifyCredentials;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Account; namespace Friendica\Test\src\Module\Api\Twitter\Account;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Account\RateLimitStatus; use Friendica\Module\Api\Twitter\Account\RateLimitStatus;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Blocks; namespace Friendica\Test\src\Module\Api\Twitter\Blocks;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Blocks\Lists; use Friendica\Module\Api\Twitter\Blocks\Lists;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\DirectMessages; namespace Friendica\Test\src\Module\Api\Twitter\DirectMessages;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Factory\Api\Twitter\DirectMessage; use Friendica\Factory\Api\Twitter\DirectMessage;
use Friendica\Module\Api\Twitter\DirectMessages\Conversation; use Friendica\Module\Api\Twitter\DirectMessages\Conversation;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\DirectMessages; namespace Friendica\Test\src\Module\Api\Twitter\DirectMessages;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Factory\Api\Twitter\DirectMessage; use Friendica\Factory\Api\Twitter\DirectMessage;
use Friendica\Module\Api\Twitter\DirectMessages\Inbox; use Friendica\Module\Api\Twitter\DirectMessages\Inbox;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\DirectMessages; namespace Friendica\Test\src\Module\Api\Twitter\DirectMessages;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Factory\Api\Twitter\DirectMessage; use Friendica\Factory\Api\Twitter\DirectMessage;
use Friendica\Module\Api\Twitter\DirectMessages\Sent; use Friendica\Module\Api\Twitter\DirectMessages\Sent;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter; namespace Friendica\Test\src\Module\Api\Twitter;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Favorites; use Friendica\Module\Api\Twitter\Favorites;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Followers; namespace Friendica\Test\src\Module\Api\Twitter\Followers;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Followers\Lists; use Friendica\Module\Api\Twitter\Followers\Lists;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Friends; namespace Friendica\Test\src\Module\Api\Twitter\Friends;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Friends\Lists; use Friendica\Module\Api\Twitter\Friends\Lists;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Friendships; namespace Friendica\Test\src\Module\Api\Twitter\Friendships;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Friendships\Incoming; use Friendica\Module\Api\Twitter\Friendships\Incoming;
use Friendica\Test\ApiTestCase; use Friendica\Test\ApiTestCase;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Lists; namespace Friendica\Test\src\Module\Api\Twitter\Lists;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Lists\Statuses; use Friendica\Module\Api\Twitter\Lists\Statuses;
use Friendica\Network\HTTPException\BadRequestException; use Friendica\Network\HTTPException\BadRequestException;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Statuses; namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Statuses\Mentions; use Friendica\Module\Api\Twitter\Statuses\Mentions;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Statuses; namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Statuses\NetworkPublicTimeline; use Friendica\Module\Api\Twitter\Statuses\NetworkPublicTimeline;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Statuses; namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Statuses\Show; use Friendica\Module\Api\Twitter\Statuses\Show;
use Friendica\Network\HTTPException\BadRequestException; use Friendica\Network\HTTPException\BadRequestException;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Statuses; namespace Friendica\Test\src\Module\Api\Twitter\Statuses;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Statuses\UserTimeline; use Friendica\Module\Api\Twitter\Statuses\UserTimeline;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Users; namespace Friendica\Test\src\Module\Api\Twitter\Users;
use Friendica\App\Router;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Users\Lookup; use Friendica\Module\Api\Twitter\Users\Lookup;
use Friendica\Network\HTTPException\NotFoundException; use Friendica\Network\HTTPException\NotFoundException;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Users; namespace Friendica\Test\src\Module\Api\Twitter\Users;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Users\Search; use Friendica\Module\Api\Twitter\Users\Search;

View file

@ -7,7 +7,6 @@
namespace Friendica\Test\src\Module\Api\Twitter\Users; namespace Friendica\Test\src\Module\Api\Twitter\Users;
use Friendica\App\Router;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Api\Twitter\Users\Show; use Friendica\Module\Api\Twitter\Users\Show;