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:
Igor Scheller 2019-04-24 11:01:37 +02:00 committed by msquare
parent 7c3a0c70e8
commit 79c92da8c1
63 changed files with 113 additions and 103 deletions

View File

@ -59,8 +59,8 @@ class ConfigServiceProvider extends ServiceProvider
/** @var Config $config */ /** @var Config $config */
$config = $this->app->get('config'); $config = $this->app->get('config');
/** @var EventConfig[] $values */
try { try {
/** @var EventConfig[] $values */
$values = $this->eventConfig->newQuery()->get(['name', 'value']); $values = $this->eventConfig->newQuery()->get(['name', 'value']);
} catch (QueryException $e) { } catch (QueryException $e) {
return; return;

View File

@ -22,10 +22,14 @@ abstract class ServiceProvider
/** /**
* Register container bindings * Register container bindings
*/ */
public function register() { } public function register()
{
}
/** /**
* Called after other services had been registered * Called after other services had been registered
*/ */
public function boot() { } public function boot()
{
}
} }

View File

@ -117,7 +117,7 @@ class Controller extends BaseController
'type' => 'counter', 'type' => 'counter',
[ [
'labels' => ['level' => LogLevel::EMERGENCY], '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::ALERT], 'value' => $this->stats->logEntries(LogLevel::ALERT)],
['labels' => ['level' => LogLevel::CRITICAL], 'value' => $this->stats->logEntries(LogLevel::CRITICAL)], ['labels' => ['level' => LogLevel::CRITICAL], 'value' => $this->stats->logEntries(LogLevel::CRITICAL)],
@ -132,7 +132,7 @@ class Controller extends BaseController
$data['scrape_duration_seconds'] = [ $data['scrape_duration_seconds'] = [
'type' => 'gauge', 'type' => 'gauge',
'help' => 'Duration of the current request', '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 return $this->response

View File

@ -69,7 +69,8 @@ class MetricsEngine implements EngineInterface
'%s%s %s', '%s%s %s',
$name, $name,
$this->renderLabels($row), $this->renderLabels($row),
$this->renderValue($row)); $this->renderValue($row)
);
} }
/** /**

View File

@ -27,6 +27,7 @@ class Stats
*/ */
public function arrivedUsers($working = null): int public function arrivedUsers($working = null): int
{ {
/** @var QueryBuilder $query */
$query = $this $query = $this
->getQuery('users') ->getQuery('users')
->join('users_state', 'user_id', '=', 'id') ->join('users_state', 'user_id', '=', 'id')
@ -40,7 +41,6 @@ class Stats
->distinct(); ->distinct();
$query->where(function ($query) use ($working) { $query->where(function ($query) use ($working) {
/** @var QueryBuilder $query */
if ($working) { if ($working) {
$query $query
->whereNotNull('ShiftEntry.SID') ->whereNotNull('ShiftEntry.SID')

View File

@ -36,7 +36,8 @@ class Migrate
{ {
$this->app = $app; $this->app = $app;
$this->schema = $schema; $this->schema = $schema;
$this->output = function () { }; $this->output = function () {
};
} }
/** /**

View File

@ -21,7 +21,8 @@ class Legacy implements HandlerInterface
*/ */
public function report(Throwable $e) 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->getCode(),
$e->getMessage(), $e->getMessage(),
$this->stripBasePath($e->getFile()), $this->stripBasePath($e->getFile()),

View File

@ -48,7 +48,7 @@ class LegacyDevelopment extends Legacy
$return[] = [ $return[] = [
'file' => $path . ':' . $line, 'file' => $path . ':' . $line,
$functionName => isset($trace['args']) ? $trace['args'] : null, $functionName => $trace['args'] ?? null,
]; ];
} }

View File

@ -2,7 +2,6 @@
namespace Engelsystem\Http; namespace Engelsystem\Http;
use Nyholm\Psr7\Stream; use Nyholm\Psr7\Stream;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;

View File

@ -13,7 +13,6 @@ use Psr\Http\Message\UploadedFileFactoryInterface;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface; use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
class Psr7ServiceProvider extends ServiceProvider class Psr7ServiceProvider extends ServiceProvider
{ {
public function register() public function register()

View File

@ -328,9 +328,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface
public function getUploadedFiles() public function getUploadedFiles()
{ {
$files = []; $files = [];
foreach ($this->files as $file) {
/** @var SymfonyFile $file */ /** @var SymfonyFile $file */
foreach ($this->files as $file) {
$files[] = new UploadedFile( $files[] = new UploadedFile(
$file->getRealPath(), $file->getRealPath(),
$file->getSize(), $file->getSize(),

View File

@ -23,6 +23,11 @@ class EngelsystemLogger extends AbstractLogger
/** @var LogEntry */ /** @var LogEntry */
protected $log; protected $log;
/**
* EngelsystemLogger constructor.
*
* @param LogEntry $log
*/
public function __construct(LogEntry $log) public function __construct(LogEntry $log)
{ {
$this->log = $log; $this->log = $log;

View File

@ -21,12 +21,16 @@ abstract class Transport implements SwiftTransport
/** /**
* Start this Transport mechanism. * Start this Transport mechanism.
*/ */
public function start() { } public function start()
{
}
/** /**
* Stop this Transport mechanism. * Stop this Transport mechanism.
*/ */
public function stop() { } public function stop()
{
}
/** /**
* Check if this Transport mechanism is alive. * Check if this Transport mechanism is alive.
@ -59,7 +63,9 @@ abstract class Transport implements SwiftTransport
* *
* @param Swift_Events_EventListener $plugin * @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 * Returns a unified list of all recipients

View File

@ -29,7 +29,7 @@ class LegacyMiddleware implements MiddlewareInterface
'users', 'users',
'user_driver_licenses', 'user_driver_licenses',
'user_password_recovery', 'user_password_recovery',
'user_worklog' 'user_worklog',
]; ];
/** @var ContainerInterface */ /** @var ContainerInterface */

View File

@ -13,7 +13,6 @@ use stdClass;
class EngelsystemLoggerTest extends ApplicationFeatureTest class EngelsystemLoggerTest extends ApplicationFeatureTest
{ {
/** /**
* @covers \Engelsystem\Logger\EngelsystemLogger::__construct
* @return LoggerInterface * @return LoggerInterface
*/ */
public function getLogger() public function getLogger()

View File

@ -34,9 +34,9 @@ class ApplicationTest extends TestCase
} }
/** /**
* @covers \Engelsystem\Application::setAppPath
* @covers \Engelsystem\Application::registerPaths
* @covers \Engelsystem\Application::path * @covers \Engelsystem\Application::path
* @covers \Engelsystem\Application::registerPaths
* @covers \Engelsystem\Application::setAppPath
*/ */
public function testAppPath() public function testAppPath()
{ {
@ -125,8 +125,8 @@ class ApplicationTest extends TestCase
/** /**
* @covers \Engelsystem\Application::bootstrap * @covers \Engelsystem\Application::bootstrap
* @covers \Engelsystem\Application::isBooted
* @covers \Engelsystem\Application::getMiddleware * @covers \Engelsystem\Application::getMiddleware
* @covers \Engelsystem\Application::isBooted
*/ */
public function testBootstrap() public function testBootstrap()
{ {

View File

@ -18,8 +18,8 @@ class ConfigServiceProviderTest extends ServiceProviderTest
use ArraySubsetAsserts; use ArraySubsetAsserts;
/** /**
* @covers \Engelsystem\Config\ConfigServiceProvider::register
* @covers \Engelsystem\Config\ConfigServiceProvider::getConfigPath * @covers \Engelsystem\Config\ConfigServiceProvider::getConfigPath
* @covers \Engelsystem\Config\ConfigServiceProvider::register
*/ */
public function testRegister() public function testRegister()
{ {

View File

@ -6,5 +6,4 @@ use Engelsystem\Container\ServiceProvider;
class ServiceProviderImplementation extends ServiceProvider class ServiceProviderImplementation extends ServiceProvider
{ {
} }

View File

@ -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::checkAuth
* @covers \Engelsystem\Controllers\Metrics\Controller::stats
*/ */
public function testStats() public function testStats()
{ {
@ -149,7 +149,7 @@ class ControllerTest extends TestCase
'user_count' => 13, 'user_count' => 13,
'arrived_user_count' => 10, 'arrived_user_count' => 10,
'done_work_hours' => 99, 'done_work_hours' => 99,
'users_in_action' => 5 'users_in_action' => 5,
])) ]))
->willReturn($response); ->willReturn($response);
@ -213,6 +213,6 @@ class ControllerTest extends TestCase
$stats = $this->createMock(Stats::class); $stats = $this->createMock(Stats::class);
$config = new Config(); $config = new Config();
return array($response, $request, $engine, $stats, $config); return [$response, $request, $engine, $stats, $config];
} }
} }

View File

@ -8,12 +8,12 @@ use Engelsystem\Test\Unit\TestCase;
class MetricsEngineTest extends 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::formatData
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::formatValue
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::get
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderLabels * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderLabels
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderValue * @covers \Engelsystem\Controllers\Metrics\MetricsEngine::renderValue
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::formatValue
* @covers \Engelsystem\Controllers\Metrics\MetricsEngine::escape
*/ */
public function testGet() public function testGet()
{ {
@ -30,13 +30,13 @@ class MetricsEngineTest extends TestCase
$this->assertEquals( $this->assertEquals(
'engelsystem_foo{lorem="ip\\\\sum"} \\"lorem\\n\\\\ipsum\\"', 'engelsystem_foo{lorem="ip\\\\sum"} \\"lorem\\n\\\\ipsum\\"',
$engine->get('/metrics', [ $engine->get('/metrics', [
'foo' => ['labels' => ['lorem' => 'ip\\sum'], 'value' => "\"lorem\n\\ipsum\""] 'foo' => ['labels' => ['lorem' => 'ip\\sum'], 'value' => "\"lorem\n\\ipsum\""],
]) ])
); );
$this->assertEquals( $this->assertEquals(
'engelsystem_foo_count{bar="14"} 42', '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( $this->assertEquals(

View File

@ -20,9 +20,9 @@ class StatsTest extends TestCase
use HasDatabase; 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::__construct
* @covers \Engelsystem\Controllers\Metrics\Stats::getQuery
* @covers \Engelsystem\Controllers\Metrics\Stats::newUsers
*/ */
public function testNewUsers() 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::raw
* @covers \Engelsystem\Controllers\Metrics\Stats::tshirtSizes
*/ */
public function testTshirtSizes() public function testTshirtSizes()
{ {

View File

@ -30,7 +30,7 @@ class DatabaseServiceProviderTest extends ServiceProviderTest
list($app, $dbManager, $pdo, $database, $connection) = $this->prepare( list($app, $dbManager, $pdo, $database, $connection) = $this->prepare(
[ [
'driver' => 'sqlite', '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::exitOnError()
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
*/ */
public function testRegisterError() public function testRegisterError()
{ {

View File

@ -16,8 +16,8 @@ class DatabaseTest extends TestCase
/** /**
* @covers \Engelsystem\Database\Database::__construct() * @covers \Engelsystem\Database\Database::__construct()
* @covers \Engelsystem\Database\Database::getPdo()
* @covers \Engelsystem\Database\Database::getConnection() * @covers \Engelsystem\Database\Database::getConnection()
* @covers \Engelsystem\Database\Database::getPdo()
*/ */
public function testInit() public function testInit()
{ {
@ -129,7 +129,8 @@ class DatabaseTest extends TestCase
id INT PRIMARY KEY NOT NULL, id INT PRIMARY KEY NOT NULL,
data TEXT NOT NULL data TEXT NOT NULL
); );
'); '
);
$connection->statement('CREATE UNIQUE INDEX test_data_id_uindex ON test_data (id);'); $connection->statement('CREATE UNIQUE INDEX test_data_id_uindex ON test_data (id);');
$connection->insert(" $connection->insert("
INSERT INTO test_data (id, data) INSERT INTO test_data (id, data)

View File

@ -12,8 +12,8 @@ use PHPUnit\Framework\TestCase;
class DbTest extends TestCase class DbTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Database\Db::setDbManager()
* @covers \Engelsystem\Database\Db::connection() * @covers \Engelsystem\Database\Db::connection()
* @covers \Engelsystem\Database\Db::setDbManager()
*/ */
public function testSetDbManager() public function testSetDbManager()
{ {
@ -132,7 +132,8 @@ class DbTest extends TestCase
id INT PRIMARY KEY NOT NULL, id INT PRIMARY KEY NOT NULL,
data TEXT NOT NULL data TEXT NOT NULL
); );
'); '
);
Db::connection()->statement('CREATE UNIQUE INDEX test_data_id_uindex ON test_data (id);'); Db::connection()->statement('CREATE UNIQUE INDEX test_data_id_uindex ON test_data (id);');
Db::insert(" Db::insert("
INSERT INTO test_data (id, data) INSERT INTO test_data (id, data)

View File

@ -15,8 +15,8 @@ class MigrateTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Database\Migration\Migrate::__construct * @covers \Engelsystem\Database\Migration\Migrate::__construct
* @covers \Engelsystem\Database\Migration\Migrate::run
* @covers \Engelsystem\Database\Migration\Migrate::getMigrations * @covers \Engelsystem\Database\Migration\Migrate::getMigrations
* @covers \Engelsystem\Database\Migration\Migrate::run
* @covers \Engelsystem\Database\Migration\Migrate::setOutput * @covers \Engelsystem\Database\Migration\Migrate::setOutput
*/ */
public function testRun() public function testRun()
@ -112,11 +112,11 @@ class MigrateTest extends TestCase
/** /**
* @covers \Engelsystem\Database\Migration\Migrate::getMigrated * @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::migrate
* @covers \Engelsystem\Database\Migration\Migrate::setMigrated * @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() public function testRunIntegration()
{ {

View File

@ -15,9 +15,9 @@ use PHPUnit\Framework\MockObject\MockObject;
class ExceptionsServiceProviderTest extends ServiceProviderTest class ExceptionsServiceProviderTest extends ServiceProviderTest
{ {
/** /**
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addProductionHandler()
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addDevelopmentHandler() * @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addDevelopmentHandler()
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::addProductionHandler()
* @covers \Engelsystem\Exceptions\ExceptionsServiceProvider::register()
*/ */
public function testRegister() public function testRegister()
{ {

View File

@ -99,8 +99,8 @@ class HandlerTest extends TestCase
} }
/** /**
* @covers \Engelsystem\Exceptions\Handler::setEnvironment()
* @covers \Engelsystem\Exceptions\Handler::getEnvironment() * @covers \Engelsystem\Exceptions\Handler::getEnvironment()
* @covers \Engelsystem\Exceptions\Handler::setEnvironment()
*/ */
public function testEnvironment() 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::getHandler()
* @covers \Engelsystem\Exceptions\Handler::setHandler()
*/ */
public function testHandler() 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::getRequest()
* @covers \Engelsystem\Exceptions\Handler::setRequest()
*/ */
public function testRequest() public function testRequest()
{ {

View File

@ -2,7 +2,6 @@
namespace Engelsystem\Test\Unit\Exceptions\handlers; namespace Engelsystem\Test\Unit\Exceptions\handlers;
use Engelsystem\Exceptions\Handlers\LegacyDevelopment; use Engelsystem\Exceptions\Handlers\LegacyDevelopment;
use Engelsystem\Http\Request; use Engelsystem\Http\Request;
use ErrorException; use ErrorException;
@ -12,8 +11,8 @@ use PHPUnit\Framework\TestCase;
class LegacyDevelopmentTest extends TestCase class LegacyDevelopmentTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render()
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::formatStackTrace() * @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::formatStackTrace()
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render()
*/ */
public function testRender() public function testRender()
{ {

View File

@ -2,7 +2,6 @@
namespace Engelsystem\Test\Unit\Exceptions\handlers; namespace Engelsystem\Test\Unit\Exceptions\handlers;
use Engelsystem\Exceptions\Handlers\Legacy; use Engelsystem\Exceptions\Handlers\Legacy;
use Engelsystem\Http\Request; use Engelsystem\Http\Request;
use Exception; use Exception;

View File

@ -2,7 +2,6 @@
namespace Engelsystem\Test\Unit\Exceptions\handlers; namespace Engelsystem\Test\Unit\Exceptions\handlers;
use Engelsystem\Application; use Engelsystem\Application;
use Engelsystem\Exceptions\Handlers\Whoops; use Engelsystem\Exceptions\Handlers\Whoops;
use Engelsystem\Helpers\Authenticator; use Engelsystem\Helpers\Authenticator;

View File

@ -67,7 +67,7 @@ class TranslationServiceProviderTest extends ServiceProviderTest
[ [
'locale' => $locale, 'locale' => $locale,
'locales' => $locales, 'locales' => $locales,
'localeChangeCallback' => [$serviceProvider, 'setLocale'] 'localeChangeCallback' => [$serviceProvider, 'setLocale'],
] ]
) )
->willReturn($translator); ->willReturn($translator);
@ -82,5 +82,3 @@ class TranslationServiceProviderTest extends ServiceProviderTest
$serviceProvider->register(); $serviceProvider->register();
} }
} }

View File

@ -11,11 +11,11 @@ class TranslatorTest extends ServiceProviderTest
{ {
/** /**
* @covers \Engelsystem\Helpers\Translator::__construct * @covers \Engelsystem\Helpers\Translator::__construct
* @covers \Engelsystem\Helpers\Translator::setLocale
* @covers \Engelsystem\Helpers\Translator::setLocales
* @covers \Engelsystem\Helpers\Translator::getLocale * @covers \Engelsystem\Helpers\Translator::getLocale
* @covers \Engelsystem\Helpers\Translator::getLocales * @covers \Engelsystem\Helpers\Translator::getLocales
* @covers \Engelsystem\Helpers\Translator::hasLocale * @covers \Engelsystem\Helpers\Translator::hasLocale
* @covers \Engelsystem\Helpers\Translator::setLocale
* @covers \Engelsystem\Helpers\Translator::setLocales
*/ */
public function testInit() 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::replaceText
* @covers \Engelsystem\Helpers\Translator::translate
*/ */
public function testTranslate() public function testTranslate()
{ {
@ -88,5 +88,3 @@ class TranslatorTest extends ServiceProviderTest
$this->assertEquals('2 Äpfel', $return); $this->assertEquals('2 Äpfel', $return);
} }
} }

View File

@ -174,7 +174,7 @@ class HelpersTest extends TestCase
->withConsecutive(['lor', 'em'], ['foo', 'bar']) ->withConsecutive(['lor', 'em'], ['foo', 'bar'])
->willReturn($response); ->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) protected function getAppMock($alias, $object)
{ {
/** @var Application|MockObject $appMock */
$appMock = $this->getMockBuilder(Container::class) $appMock = $this->getMockBuilder(Container::class)
->getMock(); ->getMock();
@ -293,7 +294,6 @@ class HelpersTest extends TestCase
->with($alias) ->with($alias)
->willReturn($object); ->willReturn($object);
/** @var $appMock Application */
Application::setInstance($appMock); Application::setInstance($appMock);
return $appMock; return $appMock;

View File

@ -9,8 +9,8 @@ class HttpExceptionTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Http\Exceptions\HttpException::__construct * @covers \Engelsystem\Http\Exceptions\HttpException::__construct
* @covers \Engelsystem\Http\Exceptions\HttpException::getStatusCode
* @covers \Engelsystem\Http\Exceptions\HttpException::getHeaders * @covers \Engelsystem\Http\Exceptions\HttpException::getHeaders
* @covers \Engelsystem\Http\Exceptions\HttpException::getStatusCode
*/ */
public function testConstruct() public function testConstruct()
{ {

View File

@ -4,8 +4,8 @@ namespace Engelsystem\Test\Unit\Http;
use Engelsystem\Application; use Engelsystem\Application;
use Engelsystem\Container\Container; use Engelsystem\Container\Container;
use Engelsystem\Http\Request;
use Engelsystem\Http\LegacyUrlGenerator; use Engelsystem\Http\LegacyUrlGenerator;
use Engelsystem\Http\Request;
use Engelsystem\Http\UrlGeneratorInterface; use Engelsystem\Http\UrlGeneratorInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@ -163,7 +163,7 @@ class RequestTest extends TestCase
[ [
'*', '*',
'/foo/bar', '/foo/bar',
'https://lorem.ipsum/test?lor=em' 'https://lorem.ipsum/test?lor=em',
] as $target ] as $target
) { ) {
$new = $request->withRequestTarget($target); $new = $request->withRequestTarget($target);

View File

@ -26,8 +26,8 @@ class ResponseTest extends TestCase
} }
/** /**
* @covers \Engelsystem\Http\Response::withStatus
* @covers \Engelsystem\Http\Response::getReasonPhrase * @covers \Engelsystem\Http\Response::getReasonPhrase
* @covers \Engelsystem\Http\Response::withStatus
*/ */
public function testWithStatus() public function testWithStatus()
{ {

View File

@ -12,8 +12,8 @@ class DatabaseHandlerTest extends TestCase
/** /**
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::__construct * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::__construct
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::read
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::getQuery * @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::getQuery
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::read
*/ */
public function testRead() 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::getCurrentTimestamp
* @covers \Engelsystem\Http\SessionHandlers\DatabaseHandler::write
*/ */
public function testWrite() public function testWrite()
{ {

View File

@ -17,8 +17,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface as
class SessionServiceProviderTest extends ServiceProviderTest class SessionServiceProviderTest extends ServiceProviderTest
{ {
/** /**
* @covers \Engelsystem\Http\SessionServiceProvider::register()
* @covers \Engelsystem\Http\SessionServiceProvider::getSessionStorage() * @covers \Engelsystem\Http\SessionServiceProvider::getSessionStorage()
* @covers \Engelsystem\Http\SessionServiceProvider::register()
*/ */
public function testRegister() public function testRegister()
{ {
@ -53,13 +53,13 @@ class SessionServiceProviderTest extends ServiceProviderTest
[Session::class], [Session::class],
[ [
NativeSessionStorage::class, NativeSessionStorage::class,
['options' => ['cookie_httponly' => true, 'name' => 'session'], 'handler' => null] ['options' => ['cookie_httponly' => true, 'name' => 'session'], 'handler' => null],
], ],
[Session::class], [Session::class],
[DatabaseHandler::class], [DatabaseHandler::class],
[ [
NativeSessionStorage::class, NativeSessionStorage::class,
['options' => ['cookie_httponly' => true, 'name' => 'foobar'], 'handler' => $databaseHandler] ['options' => ['cookie_httponly' => true, 'name' => 'foobar'], 'handler' => $databaseHandler],
], ],
[Session::class] [Session::class]
) )

View File

@ -40,9 +40,9 @@ class EngelsystemMailerTest extends TestCase
} }
/** /**
* @covers \Engelsystem\Mail\EngelsystemMailer::getSubjectPrefix
* @covers \Engelsystem\Mail\EngelsystemMailer::send * @covers \Engelsystem\Mail\EngelsystemMailer::send
* @covers \Engelsystem\Mail\EngelsystemMailer::setSubjectPrefix * @covers \Engelsystem\Mail\EngelsystemMailer::setSubjectPrefix
* @covers \Engelsystem\Mail\EngelsystemMailer::getSubjectPrefix
*/ */
public function testSend() public function testSend()
{ {

View File

@ -79,7 +79,7 @@ class MailerServiceProviderTest extends ServiceProviderTest
[SendmailTransport::class, ['email' => ['driver' => 'sendmail']]], [SendmailTransport::class, ['email' => ['driver' => 'sendmail']]],
[ [
SmtpTransport::class, SmtpTransport::class,
$this->smtpConfig $this->smtpConfig,
], ],
]; ];
} }

View File

@ -13,8 +13,8 @@ class MailerTest extends TestCase
/** /**
* @covers \Engelsystem\Mail\Mailer::__construct * @covers \Engelsystem\Mail\Mailer::__construct
* @covers \Engelsystem\Mail\Mailer::getFromAddress * @covers \Engelsystem\Mail\Mailer::getFromAddress
* @covers \Engelsystem\Mail\Mailer::setFromAddress
* @covers \Engelsystem\Mail\Mailer::getFromName * @covers \Engelsystem\Mail\Mailer::getFromName
* @covers \Engelsystem\Mail\Mailer::setFromAddress
* @covers \Engelsystem\Mail\Mailer::setFromName * @covers \Engelsystem\Mail\Mailer::setFromName
*/ */
public function testInitAndSettersAndGetters() public function testInitAndSettersAndGetters()

View File

@ -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::formatTo
* @covers \Engelsystem\Mail\Transport\Transport::getTo
*/ */
public function testGetTo() public function testGetTo()
{ {

View File

@ -6,6 +6,7 @@ use Engelsystem\Container\Container;
use Engelsystem\Http\Response; use Engelsystem\Http\Response;
use Engelsystem\Middleware\CallableHandler; use Engelsystem\Middleware\CallableHandler;
use Engelsystem\Test\Unit\Middleware\Stub\HasStaticMethod; use Engelsystem\Test\Unit\Middleware\Stub\HasStaticMethod;
use InvalidArgumentException;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
@ -18,7 +19,8 @@ class CallableHandlerTest extends TestCase
public function provideCallable() public function provideCallable()
{ {
return [ return [
[function () { }], [function () {
}],
[[$this, 'provideCallable']], [[$this, 'provideCallable']],
[[HasStaticMethod::class, 'foo']], [[HasStaticMethod::class, 'foo']],
]; ];
@ -113,7 +115,7 @@ class CallableHandlerTest extends TestCase
$this->assertEquals($response, $return); $this->assertEquals($response, $return);
$middleware = new CallableHandler($callable); $middleware = new CallableHandler($callable);
$this->expectException(\InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$middleware->handle($request); $middleware->handle($request);
} }

View File

@ -136,8 +136,8 @@ class RequestHandlerTest extends TestCase
} }
/** /**
* @covers \Engelsystem\Middleware\RequestHandler::process
* @covers \Engelsystem\Middleware\RequestHandler::checkPermissions * @covers \Engelsystem\Middleware\RequestHandler::checkPermissions
* @covers \Engelsystem\Middleware\RequestHandler::process
*/ */
public function testCheckPermissions() public function testCheckPermissions()
{ {

View File

@ -14,8 +14,8 @@ use Psr\Http\Server\MiddlewareInterface;
class ResolvesMiddlewareTraitTest extends TestCase class ResolvesMiddlewareTraitTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::resolveMiddleware
* @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::isMiddleware * @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::isMiddleware
* @covers \Engelsystem\Middleware\ResolvesMiddlewareTrait::resolveMiddleware
*/ */
public function testResolveMiddleware() public function testResolveMiddleware()
{ {

View File

@ -16,8 +16,8 @@ use Psr\Http\Server\RequestHandlerInterface;
class RouteDispatcherTest extends TestCase class RouteDispatcherTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Middleware\RouteDispatcher::process
* @covers \Engelsystem\Middleware\RouteDispatcher::__construct * @covers \Engelsystem\Middleware\RouteDispatcher::__construct
* @covers \Engelsystem\Middleware\RouteDispatcher::process
*/ */
public function testProcess() public function testProcess()
{ {

View File

@ -4,5 +4,7 @@ namespace Engelsystem\Test\Unit\Middleware\Stub;
class HasStaticMethod class HasStaticMethod
{ {
public static function foo() { } public static function foo()
{
}
} }

View File

@ -14,8 +14,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
class VerifyCsrfTokenTest extends TestCase class VerifyCsrfTokenTest extends TestCase
{ {
/** /**
* @covers \Engelsystem\Middleware\VerifyCsrfToken::process
* @covers \Engelsystem\Middleware\VerifyCsrfToken::isReading * @covers \Engelsystem\Middleware\VerifyCsrfToken::isReading
* @covers \Engelsystem\Middleware\VerifyCsrfToken::process
*/ */
public function testProcess() public function testProcess()
{ {

View File

@ -102,8 +102,7 @@ class EventConfigTest extends TestCase
*/ */
protected function getEventConfig() protected function getEventConfig()
{ {
return new class extends EventConfig return new class extends EventConfig {
{
/** /**
* @param string $value * @param string $value
* @param string $type * @param string $type

View File

@ -6,5 +6,4 @@ use Engelsystem\Models\User\HasUserModel;
class HasUserModelImplementation extends HasUserModel class HasUserModelImplementation extends HasUserModel
{ {
} }

View File

@ -37,14 +37,14 @@ class UserTest extends TestCase
'dect' => '1234567', 'dect' => '1234567',
'email' => 'foo@bar.batz', 'email' => 'foo@bar.batz',
'mobile' => '1234/12341234', 'mobile' => '1234/12341234',
] ],
], ],
[ [
PersonalData::class, PersonalData::class,
'personalData', 'personalData',
[ [
'first_name' => 'Foo' 'first_name' => 'Foo',
] ],
], ],
[ [
Settings::class, Settings::class,
@ -52,14 +52,14 @@ class UserTest extends TestCase
[ [
'language' => 'de_DE', 'language' => 'de_DE',
'theme' => 4, 'theme' => 4,
] ],
], ],
[ [
State::class, State::class,
'state', 'state',
[ [
'force_active' => true, 'force_active' => true,
] ],
], ],
]; ];
} }

View File

@ -13,8 +13,8 @@ class RendererServiceProviderTest extends ServiceProviderTest
{ {
/** /**
* @covers \Engelsystem\Renderer\RendererServiceProvider::register() * @covers \Engelsystem\Renderer\RendererServiceProvider::register()
* @covers \Engelsystem\Renderer\RendererServiceProvider::registerRenderer()
* @covers \Engelsystem\Renderer\RendererServiceProvider::registerHtmlEngine() * @covers \Engelsystem\Renderer\RendererServiceProvider::registerHtmlEngine()
* @covers \Engelsystem\Renderer\RendererServiceProvider::registerRenderer()
*/ */
public function testRegister() public function testRegister()
{ {

View File

@ -39,6 +39,7 @@ abstract class ExtensionTest extends TestCase
* @param string $name * @param string $name
* @param callable $callback * @param callable $callback
* @param TwigFunction[] $functions * @param TwigFunction[] $functions
* @param array $options
*/ */
protected function assertExtensionExists($name, $callback, $functions, $options = []) protected function assertExtensionExists($name, $callback, $functions, $options = [])
{ {

View File

@ -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::__construct
* @covers \Engelsystem\Renderer\Twig\Extensions\Legacy::getPage
*/ */
public function testIsAuthenticated() public function testIsAuthenticated()
{ {

View File

@ -13,7 +13,6 @@ abstract class ServiceProviderTest extends TestCase
*/ */
protected function getApp($methods = ['make', 'instance']) protected function getApp($methods = ['make', 'instance'])
{ {
/** @var Application|MockObject $app */
return $this->getMockBuilder(Application::class) return $this->getMockBuilder(Application::class)
->setMethods($methods) ->setMethods($methods)
->getMock(); ->getMock();

View File

@ -4,5 +4,5 @@ use Composer\Autoload\ClassLoader;
require_once __DIR__ . '/../includes/autoload.php'; require_once __DIR__ . '/../includes/autoload.php';
/** @var $loader ClassLoader */ /** @var ClassLoader $loader */
$loader->addPsr4('Engelsystem\\Test\\', __DIR__ . '/'); $loader->addPsr4('Engelsystem\\Test\\', __DIR__ . '/');