Formatting
```bash php-cs-fixer fix --allow-risky=yes --rules=@PSR2,psr4,mb_str_functions.php_unit_construct,php_unit_ordered_covers,trailing_comma_in_multiline_array --rules='{"array_syntax": {"syntax":"short"}}' [tests/|src/] ```
This commit is contained in:
parent
7c3a0c70e8
commit
79c92da8c1
|
@ -59,8 +59,8 @@ class ConfigServiceProvider extends ServiceProvider
|
|||
|
||||
/** @var Config $config */
|
||||
$config = $this->app->get('config');
|
||||
/** @var EventConfig[] $values */
|
||||
try {
|
||||
/** @var EventConfig[] $values */
|
||||
$values = $this->eventConfig->newQuery()->get(['name', 'value']);
|
||||
} catch (QueryException $e) {
|
||||
return;
|
||||
|
|
|
@ -22,10 +22,14 @@ abstract class ServiceProvider
|
|||
/**
|
||||
* Register container bindings
|
||||
*/
|
||||
public function register() { }
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after other services had been registered
|
||||
*/
|
||||
public function boot() { }
|
||||
public function boot()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class Controller extends BaseController
|
|||
'type' => 'counter',
|
||||
[
|
||||
'labels' => ['level' => LogLevel::EMERGENCY],
|
||||
'value' => $this->stats->logEntries(LogLevel::EMERGENCY)
|
||||
'value' => $this->stats->logEntries(LogLevel::EMERGENCY),
|
||||
],
|
||||
['labels' => ['level' => LogLevel::ALERT], 'value' => $this->stats->logEntries(LogLevel::ALERT)],
|
||||
['labels' => ['level' => LogLevel::CRITICAL], 'value' => $this->stats->logEntries(LogLevel::CRITICAL)],
|
||||
|
@ -132,7 +132,7 @@ class Controller extends BaseController
|
|||
$data['scrape_duration_seconds'] = [
|
||||
'type' => 'gauge',
|
||||
'help' => 'Duration of the current request',
|
||||
microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT', $now)
|
||||
microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT', $now),
|
||||
];
|
||||
|
||||
return $this->response
|
||||
|
|
|
@ -69,7 +69,8 @@ class MetricsEngine implements EngineInterface
|
|||
'%s%s %s',
|
||||
$name,
|
||||
$this->renderLabels($row),
|
||||
$this->renderValue($row));
|
||||
$this->renderValue($row)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ class Stats
|
|||
*/
|
||||
public function arrivedUsers($working = null): int
|
||||
{
|
||||
/** @var QueryBuilder $query */
|
||||
$query = $this
|
||||
->getQuery('users')
|
||||
->join('users_state', 'user_id', '=', 'id')
|
||||
|
@ -40,7 +41,6 @@ class Stats
|
|||
->distinct();
|
||||
|
||||
$query->where(function ($query) use ($working) {
|
||||
/** @var QueryBuilder $query */
|
||||
if ($working) {
|
||||
$query
|
||||
->whereNotNull('ShiftEntry.SID')
|
||||
|
|
|
@ -36,7 +36,8 @@ class Migrate
|
|||
{
|
||||
$this->app = $app;
|
||||
$this->schema = $schema;
|
||||
$this->output = function () { };
|
||||
$this->output = function () {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,8 @@ class Legacy implements HandlerInterface
|
|||
*/
|
||||
public function report(Throwable $e)
|
||||
{
|
||||
error_log(sprintf('Exception: Code: %s, Message: %s, File: %s:%u, Trace: %s',
|
||||
error_log(sprintf(
|
||||
'Exception: Code: %s, Message: %s, File: %s:%u, Trace: %s',
|
||||
$e->getCode(),
|
||||
$e->getMessage(),
|
||||
$this->stripBasePath($e->getFile()),
|
||||
|
|
|
@ -48,7 +48,7 @@ class LegacyDevelopment extends Legacy
|
|||
|
||||
$return[] = [
|
||||
'file' => $path . ':' . $line,
|
||||
$functionName => isset($trace['args']) ? $trace['args'] : null,
|
||||
$functionName => $trace['args'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Engelsystem\Http;
|
||||
|
||||
|
||||
use Nyholm\Psr7\Stream;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ use Psr\Http\Message\UploadedFileFactoryInterface;
|
|||
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
|
||||
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
|
||||
|
||||
|
||||
class Psr7ServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register()
|
||||
|
|
|
@ -328,9 +328,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
|||
public function getUploadedFiles()
|
||||
{
|
||||
$files = [];
|
||||
foreach ($this->files as $file) {
|
||||
/** @var SymfonyFile $file */
|
||||
|
||||
foreach ($this->files as $file) {
|
||||
$files[] = new UploadedFile(
|
||||
$file->getRealPath(),
|
||||
$file->getSize(),
|
||||
|
|
|
@ -23,6 +23,11 @@ class EngelsystemLogger extends AbstractLogger
|
|||
/** @var LogEntry */
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* EngelsystemLogger constructor.
|
||||
*
|
||||
* @param LogEntry $log
|
||||
*/
|
||||
public function __construct(LogEntry $log)
|
||||
{
|
||||
$this->log = $log;
|
||||
|
|
|
@ -21,12 +21,16 @@ abstract class Transport implements SwiftTransport
|
|||
/**
|
||||
* Start this Transport mechanism.
|
||||
*/
|
||||
public function start() { }
|
||||
public function start()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop this Transport mechanism.
|
||||
*/
|
||||
public function stop() { }
|
||||
public function stop()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this Transport mechanism is alive.
|
||||
|
@ -59,7 +63,9 @@ abstract class Transport implements SwiftTransport
|
|||
*
|
||||
* @param Swift_Events_EventListener $plugin
|
||||
*/
|
||||
public function registerPlugin(Swift_Events_EventListener $plugin) { }
|
||||
public function registerPlugin(Swift_Events_EventListener $plugin)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unified list of all recipients
|
||||
|
|
|
@ -29,7 +29,7 @@ class LegacyMiddleware implements MiddlewareInterface
|
|||
'users',
|
||||
'user_driver_licenses',
|
||||
'user_password_recovery',
|
||||
'user_worklog'
|
||||
'user_worklog',
|
||||
];
|
||||
|
||||
/** @var ContainerInterface */
|
||||
|
|
|
@ -13,7 +13,6 @@ use stdClass;
|
|||
class EngelsystemLoggerTest extends ApplicationFeatureTest
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Logger\EngelsystemLogger::__construct
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
public function getLogger()
|
||||
|
|
|
@ -34,9 +34,9 @@ class ApplicationTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Application::setAppPath
|
||||
* @covers \Engelsystem\Application::registerPaths
|
||||
* @covers \Engelsystem\Application::path
|
||||
* @covers \Engelsystem\Application::registerPaths
|
||||
* @covers \Engelsystem\Application::setAppPath
|
||||
*/
|
||||
public function testAppPath()
|
||||
{
|
||||
|
@ -125,8 +125,8 @@ class ApplicationTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers \Engelsystem\Application::bootstrap
|
||||
* @covers \Engelsystem\Application::isBooted
|
||||
* @covers \Engelsystem\Application::getMiddleware
|
||||
* @covers \Engelsystem\Application::isBooted
|
||||
*/
|
||||
public function testBootstrap()
|
||||
{
|
||||
|
|
|
@ -18,8 +18,8 @@ class ConfigServiceProviderTest extends ServiceProviderTest
|
|||
use ArraySubsetAsserts;
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Config\ConfigServiceProvider::register
|
||||
* @covers \Engelsystem\Config\ConfigServiceProvider::getConfigPath
|
||||
* @covers \Engelsystem\Config\ConfigServiceProvider::register
|
||||
*/
|
||||
public function testRegister()
|
||||
{
|
||||
|
|
|
@ -6,5 +6,4 @@ use Engelsystem\Container\ServiceProvider;
|
|||
|
||||
class ServiceProviderImplementation extends ServiceProvider
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -127,8 +127,8 @@ class ControllerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Controllers\Metrics\Controller::stats
|
||||
* @covers \Engelsystem\Controllers\Metrics\Controller::checkAuth
|
||||
* @covers \Engelsystem\Controllers\Metrics\Controller::stats
|
||||
*/
|
||||
public function testStats()
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ class ControllerTest extends TestCase
|
|||
'user_count' => 13,
|
||||
'arrived_user_count' => 10,
|
||||
'done_work_hours' => 99,
|
||||
'users_in_action' => 5
|
||||
'users_in_action' => 5,
|
||||
]))
|
||||
->willReturn($response);
|
||||
|
||||
|
@ -213,6 +213,6 @@ class ControllerTest extends TestCase
|
|||
$stats = $this->createMock(Stats::class);
|
||||
$config = new Config();
|
||||
|
||||
return array($response, $request, $engine, $stats, $config);
|
||||
return [$response, $request, $engine, $stats, $config];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ use Engelsystem\Test\Unit\TestCase;
|
|||
class MetricsEngineTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::get
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::escape
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::formatData
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::formatValue
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::get
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderLabels
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderValue
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::formatValue
|
||||
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::escape
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
|
@ -30,13 +30,13 @@ class MetricsEngineTest extends TestCase
|
|||
$this->assertEquals(
|
||||
'engelsystem_foo{lorem="ip\\\\sum"} \\"lorem\\n\\\\ipsum\\"',
|
||||
$engine->get('/metrics', [
|
||||
'foo' => ['labels' => ['lorem' => 'ip\\sum'], 'value' => "\"lorem\n\\ipsum\""]
|
||||
'foo' => ['labels' => ['lorem' => 'ip\\sum'], 'value' => "\"lorem\n\\ipsum\""],
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'engelsystem_foo_count{bar="14"} 42',
|
||||
$engine->get('/metrics', ['foo_count' => ['labels' => ['bar' => 14], 'value' => 42],])
|
||||
$engine->get('/metrics', ['foo_count' => ['labels' => ['bar' => 14], 'value' => 42]])
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
|
|
|
@ -20,9 +20,9 @@ class StatsTest extends TestCase
|
|||
use HasDatabase;
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::newUsers
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::getQuery
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::__construct
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::getQuery
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::newUsers
|
||||
*/
|
||||
public function testNewUsers()
|
||||
{
|
||||
|
@ -58,8 +58,8 @@ class StatsTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::tshirtSizes
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::raw
|
||||
* @covers \Engelsystem\Controllers\Metrics\Stats::tshirtSizes
|
||||
*/
|
||||
public function testTshirtSizes()
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ class DatabaseServiceProviderTest extends ServiceProviderTest
|
|||
list($app, $dbManager, $pdo, $database, $connection) = $this->prepare(
|
||||
[
|
||||
'driver' => 'sqlite',
|
||||
'database' => ':memory:'
|
||||
'database' => ':memory:',
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -51,8 +51,8 @@ class DatabaseServiceProviderTest extends ServiceProviderTest
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
|
||||
* @covers \Engelsystem\Database\DatabaseServiceProvider::exitOnError()
|
||||
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
|
||||
*/
|
||||
public function testRegisterError()
|
||||
{
|
||||
|
|
|
@ -16,8 +16,8 @@ class DatabaseTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers \Engelsystem\Database\Database::__construct()
|
||||
* @covers \Engelsystem\Database\Database::getPdo()
|
||||
* @covers \Engelsystem\Database\Database::getConnection()
|
||||
* @covers \Engelsystem\Database\Database::getPdo()
|
||||
*/
|
||||
public function testInit()
|
||||
{
|
||||
|
@ -129,7 +129,8 @@ class DatabaseTest extends TestCase
|
|||
id INT PRIMARY KEY NOT NULL,
|
||||
data TEXT NOT NULL
|
||||
);
|
||||
');
|
||||
'
|
||||
);
|
||||
$connection->statement('CREATE UNIQUE INDEX test_data_id_uindex ON test_data (id);');
|
||||
$connection->insert("
|
||||
INSERT INTO test_data (id, data)
|
||||
|
|
|
@ -12,8 +12,8 @@ use PHPUnit\Framework\TestCase;
|
|||
class DbTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Database\Db::setDbManager()
|
||||
* @covers \Engelsystem\Database\Db::connection()
|
||||
* @covers \Engelsystem\Database\Db::setDbManager()
|
||||
*/
|
||||
public function testSetDbManager()
|
||||
{
|
||||
|
@ -132,7 +132,8 @@ class DbTest extends TestCase
|
|||
id INT PRIMARY KEY NOT NULL,
|
||||
data TEXT NOT NULL
|
||||
);
|
||||
');
|
||||
'
|
||||
);
|
||||
Db::connection()->statement('CREATE UNIQUE INDEX test_data_id_uindex ON test_data (id);');
|
||||
Db::insert("
|
||||
INSERT INTO test_data (id, data)
|
||||
|
|
|
@ -15,8 +15,8 @@ class MigrateTest extends TestCase
|
|||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::__construct
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::run
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::getMigrations
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::run
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::setOutput
|
||||
*/
|
||||
public function testRun()
|
||||
|
@ -112,11 +112,11 @@ class MigrateTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::getMigrated
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::getMigrationFiles
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::getTableQuery
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::initMigration
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::migrate
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::setMigrated
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::getMigrationFiles
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::initMigration
|
||||
* @covers \Engelsystem\Database\Migration\Migrate::getTableQuery
|
||||
*/
|
||||
public function testRunIntegration()
|
||||
{
|
||||
|
|
|
@ -15,9 +15,9 @@ use PHPUnit\Framework\MockObject\MockObject;
|
|||
class ExceptionsServiceProviderTest extends ServiceProviderTest
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
|
||||
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addProductionHandler()
|
||||
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addDevelopmentHandler()
|
||||
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addProductionHandler()
|
||||
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
|
||||
*/
|
||||
public function testRegister()
|
||||
{
|
||||
|
|
|
@ -99,8 +99,8 @@ class HandlerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\Handler::setEnvironment()
|
||||
* @covers \Engelsystem\Exceptions\Handler::getEnvironment()
|
||||
* @covers \Engelsystem\Exceptions\Handler::setEnvironment()
|
||||
*/
|
||||
public function testEnvironment()
|
||||
{
|
||||
|
@ -114,8 +114,8 @@ class HandlerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\Handler::setHandler()
|
||||
* @covers \Engelsystem\Exceptions\Handler::getHandler()
|
||||
* @covers \Engelsystem\Exceptions\Handler::setHandler()
|
||||
*/
|
||||
public function testHandler()
|
||||
{
|
||||
|
@ -133,8 +133,8 @@ class HandlerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\Handler::setRequest()
|
||||
* @covers \Engelsystem\Exceptions\Handler::getRequest()
|
||||
* @covers \Engelsystem\Exceptions\Handler::setRequest()
|
||||
*/
|
||||
public function testRequest()
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Engelsystem\Test\Unit\Exceptions\handlers;
|
||||
|
||||
|
||||
use Engelsystem\Exceptions\Handlers\LegacyDevelopment;
|
||||
use Engelsystem\Http\Request;
|
||||
use ErrorException;
|
||||
|
@ -12,8 +11,8 @@ use PHPUnit\Framework\TestCase;
|
|||
class LegacyDevelopmentTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render()
|
||||
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::formatStackTrace()
|
||||
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render()
|
||||
*/
|
||||
public function testRender()
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Engelsystem\Test\Unit\Exceptions\handlers;
|
||||
|
||||
|
||||
use Engelsystem\Exceptions\Handlers\Legacy;
|
||||
use Engelsystem\Http\Request;
|
||||
use Exception;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Engelsystem\Test\Unit\Exceptions\handlers;
|
||||
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Exceptions\Handlers\Whoops;
|
||||
use Engelsystem\Helpers\Authenticator;
|
||||
|
|
|
@ -67,7 +67,7 @@ class TranslationServiceProviderTest extends ServiceProviderTest
|
|||
[
|
||||
'locale' => $locale,
|
||||
'locales' => $locales,
|
||||
'localeChangeCallback' => [$serviceProvider, 'setLocale']
|
||||
'localeChangeCallback' => [$serviceProvider, 'setLocale'],
|
||||
]
|
||||
)
|
||||
->willReturn($translator);
|
||||
|
@ -82,5 +82,3 @@ class TranslationServiceProviderTest extends ServiceProviderTest
|
|||
$serviceProvider->register();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ class TranslatorTest extends ServiceProviderTest
|
|||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Helpers\Translator::__construct
|
||||
* @covers \Engelsystem\Helpers\Translator::setLocale
|
||||
* @covers \Engelsystem\Helpers\Translator::setLocales
|
||||
* @covers \Engelsystem\Helpers\Translator::getLocale
|
||||
* @covers \Engelsystem\Helpers\Translator::getLocales
|
||||
* @covers \Engelsystem\Helpers\Translator::hasLocale
|
||||
* @covers \Engelsystem\Helpers\Translator::setLocale
|
||||
* @covers \Engelsystem\Helpers\Translator::setLocales
|
||||
*/
|
||||
public function testInit()
|
||||
{
|
||||
|
@ -47,8 +47,8 @@ class TranslatorTest extends ServiceProviderTest
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Helpers\Translator::translate
|
||||
* @covers \Engelsystem\Helpers\Translator::replaceText
|
||||
* @covers \Engelsystem\Helpers\Translator::translate
|
||||
*/
|
||||
public function testTranslate()
|
||||
{
|
||||
|
@ -88,5 +88,3 @@ class TranslatorTest extends ServiceProviderTest
|
|||
$this->assertEquals('2 Äpfel', $return);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class HelpersTest extends TestCase
|
|||
->withConsecutive(['lor', 'em'], ['foo', 'bar'])
|
||||
->willReturn($response);
|
||||
|
||||
$this->assertEquals($response, response('Lorem Ipsum?', 501, ['lor' => 'em', 'foo' => 'bar',]));
|
||||
$this->assertEquals($response, response('Lorem Ipsum?', 501, ['lor' => 'em', 'foo' => 'bar']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,6 +285,7 @@ class HelpersTest extends TestCase
|
|||
*/
|
||||
protected function getAppMock($alias, $object)
|
||||
{
|
||||
/** @var Application|MockObject $appMock */
|
||||
$appMock = $this->getMockBuilder(Container::class)
|
||||
->getMock();
|
||||
|
||||
|
@ -293,7 +294,6 @@ class HelpersTest extends TestCase
|
|||
->with($alias)
|
||||
->willReturn($object);
|
||||
|
||||
/** @var $appMock Application */
|
||||
Application::setInstance($appMock);
|
||||
|
||||
return $appMock;
|
||||
|
|
|
@ -9,8 +9,8 @@ class HttpExceptionTest extends TestCase
|
|||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Http\Exceptions\HttpException::__construct
|
||||
* @covers \Engelsystem\Http\Exceptions\HttpException::getStatusCode
|
||||
* @covers \Engelsystem\Http\Exceptions\HttpException::getHeaders
|
||||
* @covers \Engelsystem\Http\Exceptions\HttpException::getStatusCode
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace Engelsystem\Test\Unit\Http;
|
|||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Container\Container;
|
||||
use Engelsystem\Http\Request;
|
||||
use Engelsystem\Http\LegacyUrlGenerator;
|
||||
use Engelsystem\Http\Request;
|
||||
use Engelsystem\Http\UrlGeneratorInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ class RequestTest extends TestCase
|
|||
[
|
||||
'*',
|
||||
'/foo/bar',
|
||||
'https://lorem.ipsum/test?lor=em'
|
||||
'https://lorem.ipsum/test?lor=em',
|
||||
] as $target
|
||||
) {
|
||||
$new = $request->withRequestTarget($target);
|
||||
|
|
|
@ -26,8 +26,8 @@ class ResponseTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Http\Response::withStatus
|
||||
* @covers \Engelsystem\Http\Response::getReasonPhrase
|
||||
* @covers \Engelsystem\Http\Response::withStatus
|
||||
*/
|
||||
public function testWithStatus()
|
||||
{
|
||||
|
|
|
@ -12,8 +12,8 @@ class DatabaseHandlerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::__construct
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::read
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::getQuery
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::read
|
||||
*/
|
||||
public function testRead()
|
||||
{
|
||||
|
@ -25,8 +25,8 @@ class DatabaseHandlerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::write
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::getCurrentTimestamp
|
||||
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::write
|
||||
*/
|
||||
public function testWrite()
|
||||
{
|
||||
|
|
|
@ -17,8 +17,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface as
|
|||
class SessionServiceProviderTest extends ServiceProviderTest
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Http\SessionServiceProvider::register()
|
||||
* @covers \Engelsystem\Http\SessionServiceProvider::getSessionStorage()
|
||||
* @covers \Engelsystem\Http\SessionServiceProvider::register()
|
||||
*/
|
||||
public function testRegister()
|
||||
{
|
||||
|
@ -53,13 +53,13 @@ class SessionServiceProviderTest extends ServiceProviderTest
|
|||
[Session::class],
|
||||
[
|
||||
NativeSessionStorage::class,
|
||||
['options' => ['cookie_httponly' => true, 'name' => 'session'], 'handler' => null]
|
||||
['options' => ['cookie_httponly' => true, 'name' => 'session'], 'handler' => null],
|
||||
],
|
||||
[Session::class],
|
||||
[DatabaseHandler::class],
|
||||
[
|
||||
NativeSessionStorage::class,
|
||||
['options' => ['cookie_httponly' => true, 'name' => 'foobar'], 'handler' => $databaseHandler]
|
||||
['options' => ['cookie_httponly' => true, 'name' => 'foobar'], 'handler' => $databaseHandler],
|
||||
],
|
||||
[Session::class]
|
||||
)
|
||||
|
|
|
@ -40,9 +40,9 @@ class EngelsystemMailerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Mail\EngelsystemMailer::getSubjectPrefix
|
||||
* @covers \Engelsystem\Mail\EngelsystemMailer::send
|
||||
* @covers \Engelsystem\Mail\EngelsystemMailer::setSubjectPrefix
|
||||
* @covers \Engelsystem\Mail\EngelsystemMailer::getSubjectPrefix
|
||||
*/
|
||||
public function testSend()
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ class MailerServiceProviderTest extends ServiceProviderTest
|
|||
[SendmailTransport::class, ['email' => ['driver' => 'sendmail']]],
|
||||
[
|
||||
SmtpTransport::class,
|
||||
$this->smtpConfig
|
||||
$this->smtpConfig,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ class MailerTest extends TestCase
|
|||
/**
|
||||
* @covers \Engelsystem\Mail\Mailer::__construct
|
||||
* @covers \Engelsystem\Mail\Mailer::getFromAddress
|
||||
* @covers \Engelsystem\Mail\Mailer::setFromAddress
|
||||
* @covers \Engelsystem\Mail\Mailer::getFromName
|
||||
* @covers \Engelsystem\Mail\Mailer::setFromAddress
|
||||
* @covers \Engelsystem\Mail\Mailer::setFromName
|
||||
*/
|
||||
public function testInitAndSettersAndGetters()
|
||||
|
|
|
@ -70,8 +70,8 @@ class TransportTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Mail\Transport\Transport::getTo
|
||||
* @covers \Engelsystem\Mail\Transport\Transport::formatTo
|
||||
* @covers \Engelsystem\Mail\Transport\Transport::getTo
|
||||
*/
|
||||
public function testGetTo()
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ use Engelsystem\Container\Container;
|
|||
use Engelsystem\Http\Response;
|
||||
use Engelsystem\Middleware\CallableHandler;
|
||||
use Engelsystem\Test\Unit\Middleware\Stub\HasStaticMethod;
|
||||
use InvalidArgumentException;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
@ -18,7 +19,8 @@ class CallableHandlerTest extends TestCase
|
|||
public function provideCallable()
|
||||
{
|
||||
return [
|
||||
[function () { }],
|
||||
[function () {
|
||||
}],
|
||||
[[$this, 'provideCallable']],
|
||||
[[HasStaticMethod::class, 'foo']],
|
||||
];
|
||||
|
@ -113,7 +115,7 @@ class CallableHandlerTest extends TestCase
|
|||
$this->assertEquals($response, $return);
|
||||
|
||||
$middleware = new CallableHandler($callable);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$middleware->handle($request);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ class RequestHandlerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Middleware\RequestHandler::process
|
||||
* @covers \Engelsystem\Middleware\RequestHandler::checkPermissions
|
||||
* @covers \Engelsystem\Middleware\RequestHandler::process
|
||||
*/
|
||||
public function testCheckPermissions()
|
||||
{
|
||||
|
|
|
@ -14,8 +14,8 @@ use Psr\Http\Server\MiddlewareInterface;
|
|||
class ResolvesMiddlewareTraitTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::resolveMiddleware
|
||||
* @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::isMiddleware
|
||||
* @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::resolveMiddleware
|
||||
*/
|
||||
public function testResolveMiddleware()
|
||||
{
|
||||
|
|
|
@ -16,8 +16,8 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||
class RouteDispatcherTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Middleware\RouteDispatcher::process
|
||||
* @covers \Engelsystem\Middleware\RouteDispatcher::__construct
|
||||
* @covers \Engelsystem\Middleware\RouteDispatcher::process
|
||||
*/
|
||||
public function testProcess()
|
||||
{
|
||||
|
|
|
@ -4,5 +4,7 @@ namespace Engelsystem\Test\Unit\Middleware\Stub;
|
|||
|
||||
class HasStaticMethod
|
||||
{
|
||||
public static function foo() { }
|
||||
public static function foo()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
|||
class VerifyCsrfTokenTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Middleware\VerifyCsrfToken::process
|
||||
* @covers \Engelsystem\Middleware\VerifyCsrfToken::isReading
|
||||
* @covers \Engelsystem\Middleware\VerifyCsrfToken::process
|
||||
*/
|
||||
public function testProcess()
|
||||
{
|
||||
|
|
|
@ -102,8 +102,7 @@ class EventConfigTest extends TestCase
|
|||
*/
|
||||
protected function getEventConfig()
|
||||
{
|
||||
return new class extends EventConfig
|
||||
{
|
||||
return new class extends EventConfig {
|
||||
/**
|
||||
* @param string $value
|
||||
* @param string $type
|
||||
|
|
|
@ -6,5 +6,4 @@ use Engelsystem\Models\User\HasUserModel;
|
|||
|
||||
class HasUserModelImplementation extends HasUserModel
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ class UserTest extends TestCase
|
|||
'dect' => '1234567',
|
||||
'email' => 'foo@bar.batz',
|
||||
'mobile' => '1234/12341234',
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
PersonalData::class,
|
||||
'personalData',
|
||||
[
|
||||
'first_name' => 'Foo'
|
||||
]
|
||||
'first_name' => 'Foo',
|
||||
],
|
||||
],
|
||||
[
|
||||
Settings::class,
|
||||
|
@ -52,14 +52,14 @@ class UserTest extends TestCase
|
|||
[
|
||||
'language' => 'de_DE',
|
||||
'theme' => 4,
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
State::class,
|
||||
'state',
|
||||
[
|
||||
'force_active' => true,
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ class RendererServiceProviderTest extends ServiceProviderTest
|
|||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Renderer\RendererServiceProvider::register()
|
||||
* @covers \Engelsystem\Renderer\RendererServiceProvider::registerRenderer()
|
||||
* @covers \Engelsystem\Renderer\RendererServiceProvider::registerHtmlEngine()
|
||||
* @covers \Engelsystem\Renderer\RendererServiceProvider::registerRenderer()
|
||||
*/
|
||||
public function testRegister()
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ abstract class ExtensionTest extends TestCase
|
|||
* @param string $name
|
||||
* @param callable $callback
|
||||
* @param TwigFunction[] $functions
|
||||
* @param array $options
|
||||
*/
|
||||
protected function assertExtensionExists($name, $callback, $functions, $options = [])
|
||||
{
|
||||
|
|
|
@ -29,8 +29,8 @@ class LegacyTest extends ExtensionTest
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::getPage
|
||||
* @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::__construct
|
||||
* @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::getPage
|
||||
*/
|
||||
public function testIsAuthenticated()
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@ abstract class ServiceProviderTest extends TestCase
|
|||
*/
|
||||
protected function getApp($methods = ['make', 'instance'])
|
||||
{
|
||||
/** @var Application|MockObject $app */
|
||||
return $this->getMockBuilder(Application::class)
|
||||
->setMethods($methods)
|
||||
->getMock();
|
||||
|
|
|
@ -4,5 +4,5 @@ use Composer\Autoload\ClassLoader;
|
|||
|
||||
require_once __DIR__ . '/../includes/autoload.php';
|
||||
|
||||
/** @var $loader ClassLoader */
|
||||
/** @var ClassLoader $loader */
|
||||
$loader->addPsr4('Engelsystem\\Test\\', __DIR__ . '/');
|
||||
|
|
Loading…
Reference in New Issue