Fixed linter warnings
This commit is contained in:
parent
905d91d6ed
commit
87b50507f3
|
@ -26,7 +26,7 @@ return [
|
||||||
'environment' => env('ENVIRONMENT', 'production'),
|
'environment' => env('ENVIRONMENT', 'production'),
|
||||||
|
|
||||||
// Application URL and base path to use instead of the auto-detected one
|
// Application URL and base path to use instead of the auto-detected one
|
||||||
'url' => env('APP_URL', null),
|
'url' => env('APP_URL'),
|
||||||
|
|
||||||
// Header links
|
// Header links
|
||||||
// Available link placeholders: %lang%
|
// Available link placeholders: %lang%
|
||||||
|
@ -61,7 +61,7 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
// Text displayed on the FAQ page, rendered as markdown
|
// Text displayed on the FAQ page, rendered as markdown
|
||||||
'faq_text' => env('FAQ_TEXT', null),
|
'faq_text' => env('FAQ_TEXT'),
|
||||||
|
|
||||||
// Link to documentation/help
|
// Link to documentation/help
|
||||||
'documentation_url' => env('DOCUMENTATION_URL', 'https://engelsystem.de/doc/'),
|
'documentation_url' => env('DOCUMENTATION_URL', 'https://engelsystem.de/doc/'),
|
||||||
|
@ -79,20 +79,20 @@ return [
|
||||||
'host' => env('MAIL_HOST', 'localhost'),
|
'host' => env('MAIL_HOST', 'localhost'),
|
||||||
'port' => env('MAIL_PORT', 587),
|
'port' => env('MAIL_PORT', 587),
|
||||||
// If tls transport encryption should be used
|
// If tls transport encryption should be used
|
||||||
'tls' => env('MAIL_TLS', null),
|
'tls' => env('MAIL_TLS'),
|
||||||
'username' => env('MAIL_USERNAME'),
|
'username' => env('MAIL_USERNAME'),
|
||||||
'password' => env('MAIL_PASSWORD'),
|
'password' => env('MAIL_PASSWORD'),
|
||||||
'sendmail' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs'),
|
'sendmail' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs'),
|
||||||
],
|
],
|
||||||
|
|
||||||
// Your privacy@ contact address
|
// Your privacy@ contact address
|
||||||
'privacy_email' => env('PRIVACY_EMAIL', null),
|
'privacy_email' => env('PRIVACY_EMAIL'),
|
||||||
|
|
||||||
// Show opt in to save some personal data after the event on user profile and registration pages
|
// Show opt in to save some personal data after the event on user profile and registration pages
|
||||||
'enable_email_goody' => (bool) env('ENABLE_EMAIL_GOODY', true),
|
'enable_email_goody' => (bool) env('ENABLE_EMAIL_GOODY', true),
|
||||||
|
|
||||||
// Initial admin password
|
// Initial admin password
|
||||||
'setup_admin_password' => env('SETUP_ADMIN_PASSWORD', null),
|
'setup_admin_password' => env('SETUP_ADMIN_PASSWORD'),
|
||||||
|
|
||||||
'oauth' => [
|
'oauth' => [
|
||||||
// '[name]' => [config]
|
// '[name]' => [config]
|
||||||
|
@ -364,7 +364,7 @@ return [
|
||||||
'shifts_per_voucher' => env('SHIFTS_PER_VOUCHER', 0),
|
'shifts_per_voucher' => env('SHIFTS_PER_VOUCHER', 0),
|
||||||
'hours_per_voucher' => env('HOURS_PER_VOUCHER', 2),
|
'hours_per_voucher' => env('HOURS_PER_VOUCHER', 2),
|
||||||
// 'Y-m-d' formatted
|
// 'Y-m-d' formatted
|
||||||
'voucher_start' => env('VOUCHER_START', null) ?: null,
|
'voucher_start' => env('VOUCHER_START') ?: null,
|
||||||
],
|
],
|
||||||
|
|
||||||
// Enables Driving License
|
// Enables Driving License
|
||||||
|
@ -374,8 +374,7 @@ return [
|
||||||
'ifsg_enabled' => (bool) env('IFSG_ENABLED', false),
|
'ifsg_enabled' => (bool) env('IFSG_ENABLED', false),
|
||||||
|
|
||||||
# Instruction only onsite in accordance with § 43 Para. 1 of the German Infection Protection Act (IfSG)
|
# Instruction only onsite in accordance with § 43 Para. 1 of the German Infection Protection Act (IfSG)
|
||||||
'ifsg_light_enabled' => (bool) env('IFSG_LIGHT_ENABLED', false)
|
'ifsg_light_enabled' => env('IFSG_LIGHT_ENABLED', false) && env('IFSG_ENABLED', false),
|
||||||
&& env('IFSG_ENABLED', false),
|
|
||||||
|
|
||||||
// Available locales in /resources/lang/
|
// Available locales in /resources/lang/
|
||||||
// To disable a locale in the config.php, you can set its value to null
|
// To disable a locale in the config.php, you can set its value to null
|
||||||
|
@ -404,7 +403,7 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
// T-shirt Size-Guide link
|
// T-shirt Size-Guide link
|
||||||
'tshirt_link' => env('TSHIRT_LINK', null),
|
'tshirt_link' => env('TSHIRT_LINK'),
|
||||||
|
|
||||||
// Whether to show the current day of the event (-2, -1, 0, 1, 2…) in footer and on the dashboard.
|
// Whether to show the current day of the event (-2, -1, 0, 1, 2…) in footer and on the dashboard.
|
||||||
// The event start date has to be set for it to appear.
|
// The event start date has to be set for it to appear.
|
||||||
|
|
|
@ -9,7 +9,6 @@ use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class ChangeUsersContactDectFieldSize extends Migration
|
class ChangeUsersContactDectFieldSize extends Migration
|
||||||
{
|
{
|
||||||
/** @var array */
|
|
||||||
protected array $tables = [
|
protected array $tables = [
|
||||||
'AngelTypes' => 'contact_dect',
|
'AngelTypes' => 'contact_dect',
|
||||||
'users_contact' => 'dect',
|
'users_contact' => 'dect',
|
||||||
|
|
|
@ -307,9 +307,8 @@ function shift_entry_load()
|
||||||
if (!$request->has('shift_entry_id') || !test_request_int('shift_entry_id')) {
|
if (!$request->has('shift_entry_id') || !test_request_int('shift_entry_id')) {
|
||||||
throw_redirect(url('/user-shifts'));
|
throw_redirect(url('/user-shifts'));
|
||||||
}
|
}
|
||||||
$shiftEntry = ShiftEntry::findOrFail($request->input('shift_entry_id'));
|
|
||||||
|
|
||||||
return $shiftEntry;
|
return ShiftEntry::findOrFail($request->input('shift_entry_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -195,7 +195,7 @@ function shift_edit_controller()
|
||||||
htmlspecialchars($angeltype_name),
|
htmlspecialchars($angeltype_name),
|
||||||
$needed_angel_types[$angeltype_id],
|
$needed_angel_types[$angeltype_id],
|
||||||
[],
|
[],
|
||||||
ScheduleShift::whereShiftId($shift->id)->first() ? true : false,
|
(bool) ScheduleShift::whereShiftId($shift->id)->first(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Bootstrap application
|
* Bootstrap application
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Engelsystem\Application;
|
||||||
use Engelsystem\Http\UrlGeneratorInterface;
|
use Engelsystem\Http\UrlGeneratorInterface;
|
||||||
|
|
||||||
require __DIR__ . '/application.php';
|
require __DIR__ . '/application.php';
|
||||||
|
@ -18,7 +19,7 @@ require __DIR__ . '/includes.php';
|
||||||
/**
|
/**
|
||||||
* Check for maintenance
|
* Check for maintenance
|
||||||
*/
|
*/
|
||||||
/** @var \Engelsystem\Application $app */
|
/** @var Application $app */
|
||||||
if ($app->get('config')->get('maintenance')) {
|
if ($app->get('config')->get('maintenance')) {
|
||||||
http_response_code(503);
|
http_response_code(503);
|
||||||
$url = $app->get(UrlGeneratorInterface::class);
|
$url = $app->get(UrlGeneratorInterface::class);
|
||||||
|
|
|
@ -14,9 +14,6 @@ function theme_id(): int
|
||||||
return $globals['themeId'];
|
return $globals['themeId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function theme(): array
|
function theme(): array
|
||||||
{
|
{
|
||||||
$theme_id = theme_id();
|
$theme_id = theme_id();
|
||||||
|
|
|
@ -45,7 +45,7 @@ function admin_shifts()
|
||||||
$location_array = $locations->pluck('name', 'id')->toArray();
|
$location_array = $locations->pluck('name', 'id')->toArray();
|
||||||
|
|
||||||
// Load angeltypes
|
// Load angeltypes
|
||||||
/** @var AngelType[] $types */
|
/** @var AngelType[]|Collection $types */
|
||||||
$types = AngelType::all();
|
$types = AngelType::all();
|
||||||
$no_angeltypes = $types->isEmpty();
|
$no_angeltypes = $types->isEmpty();
|
||||||
$needed_angel_types = [];
|
$needed_angel_types = [];
|
||||||
|
|
|
@ -22,6 +22,7 @@ function form_hidden($name, $value)
|
||||||
* @param string $label
|
* @param string $label
|
||||||
* @param int $value
|
* @param int $value
|
||||||
* @param array $data_attributes
|
* @param array $data_attributes
|
||||||
|
* @param bool $isDisabled
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form_spinner(string $name, string $label, int $value, array $data_attributes = [], bool $isDisabled = false)
|
function form_spinner(string $name, string $label, int $value, array $data_attributes = [], bool $isDisabled = false)
|
||||||
|
@ -141,6 +142,7 @@ function form_info($label, $text = '')
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @param bool $wrapForm
|
* @param bool $wrapForm
|
||||||
* @param string $buttonType
|
* @param string $buttonType
|
||||||
|
* @param string $title
|
||||||
* @param array $dataAttributes
|
* @param array $dataAttributes
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -116,7 +116,7 @@ function check_date($input, $error_message = null, $null_allowed = false, $time_
|
||||||
} else {
|
} else {
|
||||||
$time = Carbon::createFromFormat('Y-m-d', $trimmed_input);
|
$time = Carbon::createFromFormat('Y-m-d', $trimmed_input);
|
||||||
}
|
}
|
||||||
} catch (InvalidArgumentException $e) {
|
} catch (InvalidArgumentException) {
|
||||||
$time = null;
|
$time = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ class ShiftCalendarRenderer
|
||||||
*/
|
*/
|
||||||
private function calcBlocksPerSlot()
|
private function calcBlocksPerSlot()
|
||||||
{
|
{
|
||||||
return ceil(
|
return (int) ceil(
|
||||||
($this->getLastBlockEndTime() - $this->getFirstBlockStartTime())
|
($this->getLastBlockEndTime() - $this->getFirstBlockStartTime())
|
||||||
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
&-40 {
|
&-40 {
|
||||||
// >= 40 bars
|
// >= 40 bars
|
||||||
--barchart-bar-margin: 1px;
|
|
||||||
--barchart-bar-margin: 0.5px;
|
--barchart-bar-margin: 0.5px;
|
||||||
--barchart-group-margin: 0.5%;
|
--barchart-group-margin: 0.5%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ class ConfigServiceProvider extends ServiceProvider
|
||||||
try {
|
try {
|
||||||
/** @var EventConfig[] $values */
|
/** @var EventConfig[] $values */
|
||||||
$values = $this->eventConfig->newQuery()->get(['name', 'value']);
|
$values = $this->eventConfig->newQuery()->get(['name', 'value']);
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||||
namespace Engelsystem\Controllers;
|
namespace Engelsystem\Controllers;
|
||||||
|
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
|
use DateInterval;
|
||||||
|
use DateTimeImmutable;
|
||||||
use Engelsystem\Config\Config;
|
use Engelsystem\Config\Config;
|
||||||
use Engelsystem\Helpers\BarChart;
|
use Engelsystem\Helpers\BarChart;
|
||||||
use Engelsystem\Http\Response;
|
use Engelsystem\Http\Response;
|
||||||
|
@ -60,26 +62,26 @@ class DesignController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
$themes = $this->config->get('themes');
|
$themes = $this->config->get('themes');
|
||||||
$date = new \DateTimeImmutable();
|
$date = new DateTimeImmutable();
|
||||||
$data = [
|
$data = [
|
||||||
'demo_user' => $demoUser,
|
'demo_user' => $demoUser,
|
||||||
'demo_user_2' => $demoUser2,
|
'demo_user_2' => $demoUser2,
|
||||||
'themes' => $themes,
|
'themes' => $themes,
|
||||||
'bar_chart' => BarChart::render(...BarChart::generateChartDemoData(23)),
|
'bar_chart' => BarChart::render(...BarChart::generateChartDemoData(23)),
|
||||||
|
|
||||||
'timestamp30m' => $date->add(new \DateInterval('PT30M')),
|
'timestamp30m' => $date->add(new DateInterval('PT30M')),
|
||||||
'timestamp59m' => $date->add(new \DateInterval('PT59M')),
|
'timestamp59m' => $date->add(new DateInterval('PT59M')),
|
||||||
'timestamp1h' => $date->add(new \DateInterval('PT1H')),
|
'timestamp1h' => $date->add(new DateInterval('PT1H')),
|
||||||
'timestamp1h30m' => $date->add(new \DateInterval('PT1H30M')),
|
'timestamp1h30m' => $date->add(new DateInterval('PT1H30M')),
|
||||||
'timestamp1h31m' => $date->add(new \DateInterval('PT1H31M')),
|
'timestamp1h31m' => $date->add(new DateInterval('PT1H31M')),
|
||||||
'timestamp2h' => $date->add(new \DateInterval('PT2H')),
|
'timestamp2h' => $date->add(new DateInterval('PT2H')),
|
||||||
'timestamp2d' => $date->add(new \DateInterval('P2D')),
|
'timestamp2d' => $date->add(new DateInterval('P2D')),
|
||||||
'timestamp3m' => $date->add(new \DateInterval('P3M')),
|
'timestamp3m' => $date->add(new DateInterval('P3M')),
|
||||||
'timestamp22y' => $date->add(new \DateInterval('P22Y')),
|
'timestamp22y' => $date->add(new DateInterval('P22Y')),
|
||||||
'timestamp30s' => $date->add(new \DateInterval('PT30S')),
|
'timestamp30s' => $date->add(new DateInterval('PT30S')),
|
||||||
|
|
||||||
'timestamp30mago' => $date->sub(new \DateInterval('PT30M')),
|
'timestamp30mago' => $date->sub(new DateInterval('PT30M')),
|
||||||
'timestamp45mago' => $date->sub(new \DateInterval('PT45M')),
|
'timestamp45mago' => $date->sub(new DateInterval('PT45M')),
|
||||||
'selectOptions' => $selectOptions,
|
'selectOptions' => $selectOptions,
|
||||||
'dateSelectOptions' => $dateSelectOptions,
|
'dateSelectOptions' => $dateSelectOptions,
|
||||||
];
|
];
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Controller extends BaseController
|
||||||
$oauthProviders = $this->config->get('oauth');
|
$oauthProviders = $this->config->get('oauth');
|
||||||
foreach ($userOauth as $key => $oauth) {
|
foreach ($userOauth as $key => $oauth) {
|
||||||
$provider = $oauth['labels']['provider'];
|
$provider = $oauth['labels']['provider'];
|
||||||
$name = isset($oauthProviders[$provider]['name']) ? $oauthProviders[$provider]['name'] : $provider;
|
$name = $oauthProviders[$provider]['name'] ?? $provider;
|
||||||
$userOauth[$key]['labels']['name'] = $name;
|
$userOauth[$key]['labels']['name'] = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class Controller extends BaseController
|
||||||
$data['scrape_memory_bytes'] = [
|
$data['scrape_memory_bytes'] = [
|
||||||
'type' => 'gauge',
|
'type' => 'gauge',
|
||||||
'help' => 'Memory usage of the current request',
|
'help' => 'Memory usage of the current request',
|
||||||
memory_get_usage(false),
|
memory_get_usage(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->response
|
return $this->response
|
||||||
|
@ -215,7 +215,7 @@ class Controller extends BaseController
|
||||||
$data = [
|
$data = [
|
||||||
'user_count' => $this->stats->usersState() + $this->stats->usersState(null, false),
|
'user_count' => $this->stats->usersState() + $this->stats->usersState(null, false),
|
||||||
'arrived_user_count' => $this->stats->usersState(),
|
'arrived_user_count' => $this->stats->usersState(),
|
||||||
'done_work_hours' => round($this->stats->workSeconds(true) / 60 / 60, 0),
|
'done_work_hours' => round($this->stats->workSeconds(true) / 60 / 60),
|
||||||
'users_in_action' => $this->stats->currentlyWorkingUsers(),
|
'users_in_action' => $this->stats->currentlyWorkingUsers(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ class MetricsEngine implements EngineInterface
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sum = isset($row['sum']) ? $row['sum'] : 'NaN';
|
$sum = $row['sum'] ?? 'NaN';
|
||||||
$count = $row['value']['+Inf'];
|
$count = $row['value']['+Inf'];
|
||||||
$return[] = $this->formatData($name . '_sum', $data + ['value' => $sum]);
|
$return[] = $this->formatData($name . '_sum', $data + ['value' => $sum]);
|
||||||
$return[] = $this->formatData($name . '_count', $data + ['value' => $count]);
|
$return[] = $this->formatData($name . '_count', $data + ['value' => $count]);
|
||||||
|
|
|
@ -156,9 +156,6 @@ class NewsController extends BaseController
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
protected function renderView(string $page, array $data): Response
|
protected function renderView(string $page, array $data): Response
|
||||||
{
|
{
|
||||||
return $this->response->withView($page, $data);
|
return $this->response->withView($page, $data);
|
||||||
|
|
|
@ -424,7 +424,7 @@ class SettingsController extends BaseController
|
||||||
protected function checkOauthHidden(): bool
|
protected function checkOauthHidden(): bool
|
||||||
{
|
{
|
||||||
foreach (config('oauth') as $config) {
|
foreach (config('oauth') as $config) {
|
||||||
if (empty($config['hidden']) || !$config['hidden']) {
|
if (empty($config['hidden'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,7 @@ class Handler
|
||||||
$this->request = new Request();
|
$this->request = new Request();
|
||||||
}
|
}
|
||||||
|
|
||||||
$handler = isset($this->handler[$this->environment->value])
|
$handler = $this->handler[$this->environment->value] ?? new Legacy();
|
||||||
? $this->handler[$this->environment->value] : new Legacy();
|
|
||||||
$handler->report($e);
|
$handler->report($e);
|
||||||
ob_start();
|
ob_start();
|
||||||
$handler->render($this->request, $e);
|
$handler->render($this->request, $e);
|
||||||
|
@ -65,7 +64,12 @@ class Handler
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!headers_sent()) {
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
$this->terminateApplicationImmediately();
|
$this->terminateApplicationImmediately();
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Legacy implements HandlerInterface
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->log->critical('', ['exception' => $e]);
|
$this->log->critical('', ['exception' => $e]);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,5 @@ class NullHandler extends Legacy
|
||||||
{
|
{
|
||||||
public function render(Request $request, Throwable $e): void
|
public function render(Request $request, Throwable $e): void
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Carbon extends \Carbon\Carbon
|
||||||
public static function createTimestampFromDatetime(string $value): ?int
|
public static function createTimestampFromDatetime(string $value): ?int
|
||||||
{
|
{
|
||||||
$carbon = self::createFromDateTime($value);
|
$carbon = self::createFromDateTime($value);
|
||||||
return $carbon === null ? null : $carbon->timestamp;
|
return $carbon?->timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Translator
|
||||||
try {
|
try {
|
||||||
$translated = call_user_func_array([$translator, $type], $parameters);
|
$translated = call_user_func_array([$translator, $type], $parameters);
|
||||||
break;
|
break;
|
||||||
} catch (TranslationNotFound $e) {
|
} catch (TranslationNotFound) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Engelsystem\Http;
|
namespace Engelsystem\Http;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use Nyholm\Psr7\UploadedFile;
|
use Nyholm\Psr7\UploadedFile;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Message\UploadedFileInterface;
|
use Psr\Http\Message\UploadedFileInterface;
|
||||||
|
@ -124,7 +125,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
*
|
*
|
||||||
* @param string $method Case-sensitive method.
|
* @param string $method Case-sensitive method.
|
||||||
* @return static
|
* @return static
|
||||||
* @throws \InvalidArgumentException for invalid HTTP methods.
|
* @throws InvalidArgumentException for invalid HTTP methods.
|
||||||
*/
|
*/
|
||||||
public function withMethod(mixed $method): static
|
public function withMethod(mixed $method): static
|
||||||
{
|
{
|
||||||
|
@ -309,7 +310,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
*
|
*
|
||||||
* @param array $uploadedFiles An array tree of UploadedFileInterface instances.
|
* @param array $uploadedFiles An array tree of UploadedFileInterface instances.
|
||||||
* @return static
|
* @return static
|
||||||
* @throws \InvalidArgumentException if an invalid structure is provided.
|
* @throws InvalidArgumentException if an invalid structure is provided.
|
||||||
*/
|
*/
|
||||||
public function withUploadedFiles(array $uploadedFiles): static
|
public function withUploadedFiles(array $uploadedFiles): static
|
||||||
{
|
{
|
||||||
|
@ -381,7 +382,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @param null|array|object $data The deserialized body data. This will
|
* @param null|array|object $data The deserialized body data. This will
|
||||||
* typically be in an array or object.
|
* typically be in an array or object.
|
||||||
* @return static
|
* @return static
|
||||||
* @throws \InvalidArgumentException if an unsupported argument type is
|
* @throws InvalidArgumentException if an unsupported argument type is
|
||||||
* provided.
|
* provided.
|
||||||
*/
|
*/
|
||||||
public function withParsedBody(mixed $data): static
|
public function withParsedBody(mixed $data): static
|
||||||
|
|
|
@ -42,8 +42,6 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepend the auto-detected or configured app base path and domain
|
* Prepend the auto-detected or configured app base path and domain
|
||||||
*
|
|
||||||
* @param $path
|
|
||||||
*/
|
*/
|
||||||
protected function generateUrl(string $path): string
|
protected function generateUrl(string $path): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Engelsystem\Http\Request;
|
||||||
|
|
||||||
trait ValidatesRequest
|
trait ValidatesRequest
|
||||||
{
|
{
|
||||||
protected Validator $validator;
|
protected ?Validator $validator;
|
||||||
|
|
||||||
protected function validate(Request $request, array $rules): array
|
protected function validate(Request $request, array $rules): array
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Validator
|
||||||
$v = new RespectValidator();
|
$v = new RespectValidator();
|
||||||
$v->with('\\Engelsystem\\Http\\Validation\\Rules', true);
|
$v->with('\\Engelsystem\\Http\\Validation\\Rules', true);
|
||||||
|
|
||||||
$value = isset($data[$key]) ? $data[$key] : null;
|
$value = $data[$key] ?? null;
|
||||||
$values = explode('|', $values);
|
$values = explode('|', $values);
|
||||||
|
|
||||||
// Rules that have side effects on others like inverting the result with not and making them optional
|
// Rules that have side effects on others like inverting the result with not and making them optional
|
||||||
|
|
|
@ -65,14 +65,14 @@ class ErrorHandler implements MiddlewareInterface
|
||||||
if ($request instanceof Request) {
|
if ($request instanceof Request) {
|
||||||
$response->withInput(Arr::except($request->request->all(), $this->formIgnore));
|
$response->withInput(Arr::except($request->request->all(), $this->formIgnore));
|
||||||
}
|
}
|
||||||
} catch (ModelNotFoundException $e) {
|
} catch (ModelNotFoundException) {
|
||||||
$response = $this->createResponse('', 404);
|
$response = $this->createResponse('', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusCode = $response->getStatusCode();
|
$statusCode = $response->getStatusCode();
|
||||||
$contentType = $response->getHeader('content-type');
|
$contentType = $response->getHeader('content-type');
|
||||||
$contentType = array_shift($contentType);
|
$contentType = array_shift($contentType);
|
||||||
if (!$contentType && strpos($response->getBody()?->getContents() ?? '', '<html') !== false) {
|
if (!$contentType && str_contains($response->getBody()?->getContents() ?? '', '<html')) {
|
||||||
$contentType = 'text/html';
|
$contentType = 'text/html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ class LegacyMiddleware implements MiddlewareInterface
|
||||||
return response($content, $page);
|
return response($content, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos((string) $content, '<html') !== false) {
|
if (str_contains($content, '<html')) {
|
||||||
return response($content);
|
return response($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,7 @@ class LegacyMiddleware implements MiddlewareInterface
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'content' => msg() . $content,
|
'content' => msg() . $content,
|
||||||
]
|
]
|
||||||
),
|
)
|
||||||
200
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,6 @@ class EventConfig extends BaseModel
|
||||||
*/
|
*/
|
||||||
protected function getValueCast(string $value): ?string
|
protected function getValueCast(string $value): ?string
|
||||||
{
|
{
|
||||||
return isset($this->valueCasts[$value]) ? $this->valueCasts[$value] : null;
|
return $this->valueCasts[$value] ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,14 @@ interface EngineInterface
|
||||||
*/
|
*/
|
||||||
public function get(string $path, array $data = []): string;
|
public function get(string $path, array $data = []): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the engine can render the specified template
|
||||||
|
*/
|
||||||
public function canRender(string $path): bool;
|
public function canRender(string $path): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Add shared variables
|
||||||
|
*
|
||||||
* @param string|mixed[] $key
|
* @param string|mixed[] $key
|
||||||
*/
|
*/
|
||||||
public function share(string|array $key, mixed $value = null): void;
|
public function share(string|array $key, mixed $value = null): void;
|
||||||
|
|
|
@ -16,11 +16,9 @@ class HtmlEngine extends Engine
|
||||||
$data = array_replace_recursive($this->sharedData, $data);
|
$data = array_replace_recursive($this->sharedData, $data);
|
||||||
$template = file_get_contents($path);
|
$template = file_get_contents($path);
|
||||||
|
|
||||||
if (is_array($data)) {
|
|
||||||
foreach ($data as $name => $content) {
|
foreach ($data as $name => $content) {
|
||||||
$template = str_replace('%' . $name . '%', $content, $template);
|
$template = str_replace('%' . $name . '%', $content, $template);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,7 @@ class Renderer
|
||||||
return $renderer->get($template, $data);
|
return $renderer->get($template, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->logger) {
|
$this->logger?->critical('Unable to find a renderer for template file "{file}"', ['file' => $template]);
|
||||||
$this->logger->critical('Unable to find a renderer for template file "{file}"', ['file' => $template]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,6 @@ class ApplicationTest extends TestCase
|
||||||
->willReturnOnConsecutiveCalls([$serviceProvider], $middleware);
|
->willReturnOnConsecutiveCalls([$serviceProvider], $middleware);
|
||||||
|
|
||||||
$property = (new ReflectionClass($app))->getProperty('serviceProviders');
|
$property = (new ReflectionClass($app))->getProperty('serviceProviders');
|
||||||
$property->setAccessible(true);
|
|
||||||
$property->setValue($app, [$serviceProvider]);
|
$property->setValue($app, [$serviceProvider]);
|
||||||
|
|
||||||
$app->bootstrap($config);
|
$app->bootstrap($config);
|
||||||
|
|
|
@ -22,7 +22,6 @@ class RoutesFileTest extends TestCase
|
||||||
->onlyMethods(['addRoute'])
|
->onlyMethods(['addRoute'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->doesNotPerformAssertions();
|
|
||||||
/** @see RouteCollector::addRoute */
|
/** @see RouteCollector::addRoute */
|
||||||
$route->expects($this->any())
|
$route->expects($this->any())
|
||||||
->method('addRoute')
|
->method('addRoute')
|
||||||
|
|
|
@ -13,7 +13,6 @@ use Engelsystem\Test\Unit\Controllers\ControllerTest;
|
||||||
|
|
||||||
class FaqControllerTest extends ControllerTest
|
class FaqControllerTest extends ControllerTest
|
||||||
{
|
{
|
||||||
/** @var array */
|
|
||||||
protected array $data = [
|
protected array $data = [
|
||||||
'question' => 'Foo?',
|
'question' => 'Foo?',
|
||||||
'text' => 'Bar!',
|
'text' => 'Bar!',
|
||||||
|
|
|
@ -21,7 +21,6 @@ class NewsControllerTest extends ControllerTest
|
||||||
protected Authenticator|MockObject $auth;
|
protected Authenticator|MockObject $auth;
|
||||||
protected EventDispatcher|MockObject $eventDispatcher;
|
protected EventDispatcher|MockObject $eventDispatcher;
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
protected array $data = [
|
protected array $data = [
|
||||||
[
|
[
|
||||||
'title' => 'Foo',
|
'title' => 'Foo',
|
||||||
|
|
|
@ -136,7 +136,7 @@ class UserShirtControllerTest extends ControllerTest
|
||||||
try {
|
try {
|
||||||
$controller->saveShirt($request);
|
$controller->saveShirt($request);
|
||||||
self::fail('Expected exception was not raised');
|
self::fail('Expected exception was not raised');
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
$user = User::find(1);
|
$user = User::find(1);
|
||||||
|
|
|
@ -99,7 +99,7 @@ class AuthControllerTest extends ControllerTest
|
||||||
try {
|
try {
|
||||||
$controller->postLogin($request);
|
$controller->postLogin($request);
|
||||||
$this->fail('Login without credentials possible');
|
$this->fail('Login without credentials possible');
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Missing password
|
// Missing password
|
||||||
|
@ -107,7 +107,7 @@ class AuthControllerTest extends ControllerTest
|
||||||
try {
|
try {
|
||||||
$controller->postLogin($request);
|
$controller->postLogin($request);
|
||||||
$this->fail('Login without password possible');
|
$this->fail('Login without password possible');
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No user found
|
// No user found
|
||||||
|
|
|
@ -23,7 +23,6 @@ class NewsControllerTest extends ControllerTest
|
||||||
|
|
||||||
protected Authenticator|MockObject $auth;
|
protected Authenticator|MockObject $auth;
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
protected array $data = [
|
protected array $data = [
|
||||||
[
|
[
|
||||||
'title' => 'Foo',
|
'title' => 'Foo',
|
||||||
|
|
|
@ -459,10 +459,10 @@ class OAuthControllerTest extends TestCase
|
||||||
$this->assertEquals(4242424242, $this->session->get('oauth2_expires_at')->unix());
|
$this->assertEquals(4242424242, $this->session->get('oauth2_expires_at')->unix());
|
||||||
$this->assertFalse($this->session->get('oauth2_enable_password'));
|
$this->assertFalse($this->session->get('oauth2_enable_password'));
|
||||||
$this->assertEquals(null, $this->session->get('oauth2_allow_registration'));
|
$this->assertEquals(null, $this->session->get('oauth2_allow_registration'));
|
||||||
$this->assertEquals($this->session->get('form-data-username'), 'username');
|
$this->assertEquals('username', $this->session->get('form-data-username'));
|
||||||
$this->assertEquals($this->session->get('form-data-email'), 'foo.bar@localhost');
|
$this->assertEquals('foo.bar@localhost', $this->session->get('form-data-email'));
|
||||||
$this->assertEquals($this->session->get('form-data-firstname'), 'Foo');
|
$this->assertEquals('Foo', $this->session->get('form-data-firstname'));
|
||||||
$this->assertEquals($this->session->get('form-data-lastname'), 'Bar');
|
$this->assertEquals('Bar', $this->session->get('form-data-lastname'));
|
||||||
|
|
||||||
$this->config->set('registration_enabled', false);
|
$this->config->set('registration_enabled', false);
|
||||||
$this->expectException(HttpNotFound::class);
|
$this->expectException(HttpNotFound::class);
|
||||||
|
@ -539,10 +539,10 @@ class OAuthControllerTest extends TestCase
|
||||||
$this->setExpects($controller, 'getProvider', ['testprovider'], $provider, $this->atLeastOnce());
|
$this->setExpects($controller, 'getProvider', ['testprovider'], $provider, $this->atLeastOnce());
|
||||||
|
|
||||||
$controller->index($request);
|
$controller->index($request);
|
||||||
$this->assertEquals($this->session->get('form-data-username'), 'testuser');
|
$this->assertEquals('testuser', $this->session->get('form-data-username'));
|
||||||
$this->assertEquals($this->session->get('form-data-email'), 'foo.bar@localhost');
|
$this->assertEquals('foo.bar@localhost', $this->session->get('form-data-email'));
|
||||||
$this->assertEquals($this->session->get('form-data-firstname'), 'Test');
|
$this->assertEquals('Test', $this->session->get('form-data-firstname'));
|
||||||
$this->assertEquals($this->session->get('form-data-lastname'), 'Tester');
|
$this->assertEquals('Tester', $this->session->get('form-data-lastname'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ class PasswordResetControllerTest extends ControllerTest
|
||||||
use ArraySubsetAsserts;
|
use ArraySubsetAsserts;
|
||||||
use HasDatabase;
|
use HasDatabase;
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
protected array $args = [];
|
protected array $args = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -188,7 +188,6 @@ final class RegistrationControllerTest extends ControllerTest
|
||||||
public function testViewRegistrationDisabled(): void
|
public function testViewRegistrationDisabled(): void
|
||||||
{
|
{
|
||||||
$this->config->set('registration_enabled', false);
|
$this->config->set('registration_enabled', false);
|
||||||
$request = $this->request->withParsedBody([]);
|
|
||||||
|
|
||||||
// Assert the controller does not call createFromData
|
// Assert the controller does not call createFromData
|
||||||
$this->userFactory
|
$this->userFactory
|
||||||
|
@ -201,7 +200,7 @@ final class RegistrationControllerTest extends ControllerTest
|
||||||
->method('redirectTo')
|
->method('redirectTo')
|
||||||
->with('http://localhost/', 302);
|
->with('http://localhost/', 302);
|
||||||
|
|
||||||
$this->subject->view($request);
|
$this->subject->view();
|
||||||
|
|
||||||
// Assert that the error notification is there
|
// Assert that the error notification is there
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
|
@ -773,8 +773,8 @@ class SettingsControllerTest extends ControllerTest
|
||||||
|
|
||||||
$this->controller->saveIfsgCertificate($this->request);
|
$this->controller->saveIfsgCertificate($this->request);
|
||||||
|
|
||||||
$this->assertEquals(true, $this->user->license->ifsg_certificate_light);
|
$this->assertTrue($this->user->license->ifsg_certificate_light);
|
||||||
$this->assertEquals(false, $this->user->license->ifsg_certificate);
|
$this->assertFalse($this->user->license->ifsg_certificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -803,8 +803,8 @@ class SettingsControllerTest extends ControllerTest
|
||||||
|
|
||||||
$this->controller->saveIfsgCertificate($this->request);
|
$this->controller->saveIfsgCertificate($this->request);
|
||||||
|
|
||||||
$this->assertEquals(false, $this->user->license->ifsg_certificate_light);
|
$this->assertFalse($this->user->license->ifsg_certificate_light);
|
||||||
$this->assertEquals(false, $this->user->license->ifsg_certificate);
|
$this->assertFalse($this->user->license->ifsg_certificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -831,8 +831,8 @@ class SettingsControllerTest extends ControllerTest
|
||||||
|
|
||||||
$this->controller->saveIfsgCertificate($this->request);
|
$this->controller->saveIfsgCertificate($this->request);
|
||||||
|
|
||||||
$this->assertEquals(false, $this->user->license->ifsg_certificate_light);
|
$this->assertFalse($this->user->license->ifsg_certificate_light);
|
||||||
$this->assertEquals(true, $this->user->license->ifsg_certificate);
|
$this->assertTrue($this->user->license->ifsg_certificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -859,8 +859,8 @@ class SettingsControllerTest extends ControllerTest
|
||||||
|
|
||||||
$this->controller->saveIfsgCertificate($this->request);
|
$this->controller->saveIfsgCertificate($this->request);
|
||||||
|
|
||||||
$this->assertEquals(false, $this->user->license->ifsg_certificate_light);
|
$this->assertFalse($this->user->license->ifsg_certificate_light);
|
||||||
$this->assertEquals(true, $this->user->license->ifsg_certificate);
|
$this->assertTrue($this->user->license->ifsg_certificate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -154,7 +154,7 @@ class MigrateTest extends TestCase
|
||||||
$this->setExpects($migration, 'getMigrations', null, collect([
|
$this->setExpects($migration, 'getMigrations', null, collect([
|
||||||
['migration' => '1234_01_23_123456_init_foo', 'path' => '/foo'],
|
['migration' => '1234_01_23_123456_init_foo', 'path' => '/foo'],
|
||||||
]));
|
]));
|
||||||
$this->setExpects($migration, 'getMigrated', null, collect([]));
|
$this->setExpects($migration, 'getMigrated', null, collect());
|
||||||
$migration->expects($this->once())
|
$migration->expects($this->once())
|
||||||
->method('migrate')
|
->method('migrate')
|
||||||
->willReturnCallback(function (): void {
|
->willReturnCallback(function (): void {
|
||||||
|
|
|
@ -9,7 +9,6 @@ use Engelsystem\Test\Unit\TestCase;
|
||||||
|
|
||||||
class EventDispatcherTest extends TestCase
|
class EventDispatcherTest extends TestCase
|
||||||
{
|
{
|
||||||
/** @var array */
|
|
||||||
protected array $firedEvents = [];
|
protected array $firedEvents = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,7 +72,6 @@ class XmlParserTest extends TestCase
|
||||||
$this->assertEquals('Testing', $tracks[0]->getName());
|
$this->assertEquals('Testing', $tracks[0]->getName());
|
||||||
$this->assertEquals('#dead55', $tracks[0]->getColor());
|
$this->assertEquals('#dead55', $tracks[0]->getColor());
|
||||||
$this->assertEquals('testing', $tracks[0]->getSlug());
|
$this->assertEquals('testing', $tracks[0]->getSlug());
|
||||||
;
|
|
||||||
|
|
||||||
/** @var Day $day */
|
/** @var Day $day */
|
||||||
$day = Arr::first($schedule->getDays());
|
$day = Arr::first($schedule->getDays());
|
||||||
|
|
|
@ -17,7 +17,11 @@ class UserModelImplementation extends User
|
||||||
|
|
||||||
public static ?string $apiKey = null;
|
public static ?string $apiKey = null;
|
||||||
|
|
||||||
public function find(mixed $id, array $columns = ['*']): ?User
|
/**
|
||||||
|
* @param mixed $id
|
||||||
|
* @param array $columns
|
||||||
|
*/
|
||||||
|
public function find($id, $columns = ['*']): ?User // phpcs:ignore
|
||||||
{
|
{
|
||||||
if ($id != static::$id) {
|
if ($id != static::$id) {
|
||||||
throw new InvalidArgumentException('Wrong user ID searched');
|
throw new InvalidArgumentException('Wrong user ID searched');
|
||||||
|
@ -29,9 +33,9 @@ class UserModelImplementation extends User
|
||||||
/**
|
/**
|
||||||
* @return User[]|Collection|QueryBuilder
|
* @return User[]|Collection|QueryBuilder
|
||||||
*/
|
*/
|
||||||
public static function whereApiKey(string $apiKey): array|Collection|QueryBuilder
|
public static function whereApiKey(string $value): array|Collection|QueryBuilder
|
||||||
{
|
{
|
||||||
if ($apiKey != static::$apiKey) {
|
if ($value != static::$apiKey) {
|
||||||
throw new InvalidArgumentException('Wrong api key searched');
|
throw new InvalidArgumentException('Wrong api key searched');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ShirtSizeTest extends ServiceProviderTest
|
||||||
*/
|
*/
|
||||||
public function provideTestValidateData(): array
|
public function provideTestValidateData(): array
|
||||||
{
|
{
|
||||||
$data = [
|
return [
|
||||||
'empty string' => ['', false],
|
'empty string' => ['', false],
|
||||||
'null' => [null, false],
|
'null' => [null, false],
|
||||||
'0' => [0, false],
|
'0' => [0, false],
|
||||||
|
@ -34,8 +34,6 @@ class ShirtSizeTest extends ServiceProviderTest
|
||||||
'"M" (known value)' => ['M', true],
|
'"M" (known value)' => ['M', true],
|
||||||
'"L" (unknown value)' => ['L', false],
|
'"L" (unknown value)' => ['L', false],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,6 @@ use Symfony\Component\Mailer\Transport\TransportInterface;
|
||||||
|
|
||||||
class MailerServiceProviderTest extends ServiceProviderTest
|
class MailerServiceProviderTest extends ServiceProviderTest
|
||||||
{
|
{
|
||||||
/** @var array */
|
|
||||||
protected array $defaultConfig = [
|
protected array $defaultConfig = [
|
||||||
'app_name' => 'Engelsystem App',
|
'app_name' => 'Engelsystem App',
|
||||||
'email' => [
|
'email' => [
|
||||||
|
@ -33,7 +32,6 @@ class MailerServiceProviderTest extends ServiceProviderTest
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
protected array $smtpConfig = [
|
protected array $smtpConfig = [
|
||||||
'email' => [
|
'email' => [
|
||||||
'driver' => 'smtp',
|
'driver' => 'smtp',
|
||||||
|
|
|
@ -36,7 +36,6 @@ class DispatcherTest extends TestCase
|
||||||
|
|
||||||
$reflection = new Reflection(get_class($dispatcher));
|
$reflection = new Reflection(get_class($dispatcher));
|
||||||
$property = $reflection->getProperty('container');
|
$property = $reflection->getProperty('container');
|
||||||
$property->setAccessible(true);
|
|
||||||
$this->assertEquals($container, $property->getValue($dispatcher));
|
$this->assertEquals($container, $property->getValue($dispatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +65,6 @@ class DispatcherTest extends TestCase
|
||||||
|
|
||||||
$reflection = new Reflection(get_class($dispatcher));
|
$reflection = new Reflection(get_class($dispatcher));
|
||||||
$property = $reflection->getProperty('next');
|
$property = $reflection->getProperty('next');
|
||||||
$property->setAccessible(true);
|
|
||||||
|
|
||||||
$this->assertEquals($handler, $property->getValue($dispatcher));
|
$this->assertEquals($handler, $property->getValue($dispatcher));
|
||||||
}
|
}
|
||||||
|
@ -113,7 +111,6 @@ class DispatcherTest extends TestCase
|
||||||
|
|
||||||
$reflection = new Reflection(get_class($dispatcher));
|
$reflection = new Reflection(get_class($dispatcher));
|
||||||
$property = $reflection->getProperty('next');
|
$property = $reflection->getProperty('next');
|
||||||
$property->setAccessible(true);
|
|
||||||
$property->setValue($dispatcher, $handler);
|
$property->setValue($dispatcher, $handler);
|
||||||
|
|
||||||
$return = $dispatcher->handle($request);
|
$return = $dispatcher->handle($request);
|
||||||
|
@ -193,7 +190,6 @@ class DispatcherTest extends TestCase
|
||||||
|
|
||||||
$reflection = new Reflection(get_class($middleware));
|
$reflection = new Reflection(get_class($middleware));
|
||||||
$property = $reflection->getProperty('container');
|
$property = $reflection->getProperty('container');
|
||||||
$property->setAccessible(true);
|
|
||||||
|
|
||||||
$this->assertEquals($container, $property->getValue($middleware));
|
$this->assertEquals($container, $property->getValue($middleware));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ class RequestHandlerTest extends TestCase
|
||||||
|
|
||||||
$reflection = new Reflection(get_class($handler));
|
$reflection = new Reflection(get_class($handler));
|
||||||
$property = $reflection->getProperty('container');
|
$property = $reflection->getProperty('container');
|
||||||
$property->setAccessible(true);
|
|
||||||
|
|
||||||
$this->assertEquals($container, $property->getValue($handler));
|
$this->assertEquals($container, $property->getValue($handler));
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,6 @@ class EventConfigTest extends ModelTest
|
||||||
{
|
{
|
||||||
$model = new EventConfig(['name' => 'foo', 'value' => 'bar']);
|
$model = new EventConfig(['name' => 'foo', 'value' => 'bar']);
|
||||||
$this->assertEquals('bar', $model->value);
|
$this->assertEquals('bar', $model->value);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,6 @@ class NewsCommentsTest extends ModelTest
|
||||||
|
|
||||||
private News $news;
|
private News $news;
|
||||||
|
|
||||||
/** @var array */
|
|
||||||
private array $newsCommentData;
|
private array $newsCommentData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,6 @@ use Engelsystem\Models\User\User;
|
||||||
*/
|
*/
|
||||||
class NewsTest extends ModelTest
|
class NewsTest extends ModelTest
|
||||||
{
|
{
|
||||||
/** @var array */
|
|
||||||
private array $newsData;
|
private array $newsData;
|
||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Engelsystem\Test\Unit\TestCase;
|
||||||
use Exception;
|
use Exception;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use Twig\Node\Node as TwigNode;
|
use Twig\Node\Node as TwigNode;
|
||||||
|
use Twig\TwigFilter;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
abstract class ExtensionTest extends TestCase
|
abstract class ExtensionTest extends TestCase
|
||||||
|
@ -35,9 +36,9 @@ abstract class ExtensionTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert that a twig function was registered
|
* Assert that a twig function or filter was registered
|
||||||
*
|
*
|
||||||
* @param TwigFunction[] $functions
|
* @param TwigFunction[]|TwigFilter[] $functions
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function assertExtensionExists(
|
protected function assertExtensionExists(
|
||||||
|
|
|
@ -19,7 +19,6 @@ class TwigLoaderTest extends TestCase
|
||||||
|
|
||||||
$reflection = new Reflection(get_class($loader));
|
$reflection = new Reflection(get_class($loader));
|
||||||
$property = $reflection->getProperty('cache');
|
$property = $reflection->getProperty('cache');
|
||||||
$property->setAccessible(true);
|
|
||||||
|
|
||||||
$realPath = __DIR__ . '/Stub/foo.twig';
|
$realPath = __DIR__ . '/Stub/foo.twig';
|
||||||
$property->setValue($loader, ['Stub/foo.twig' => $realPath]);
|
$property->setValue($loader, ['Stub/foo.twig' => $realPath]);
|
||||||
|
|
|
@ -197,7 +197,6 @@ class TwigServiceProviderTest extends ServiceProviderTest
|
||||||
$reflection = new Reflection(get_class($serviceProvider));
|
$reflection = new Reflection(get_class($serviceProvider));
|
||||||
|
|
||||||
$property = $reflection->getProperty('extensions');
|
$property = $reflection->getProperty('extensions');
|
||||||
$property->setAccessible(true);
|
|
||||||
|
|
||||||
$property->setValue($serviceProvider, $extensions);
|
$property->setValue($serviceProvider, $extensions);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue