[TESTS] Add tests to all relevant methods under App\Util and fix errors that popup

This commit is contained in:
2021-04-10 21:57:00 +00:00
parent 57dad5eca4
commit 8b5bd40421
13 changed files with 411 additions and 66 deletions

View File

@@ -48,7 +48,7 @@ use Twig\Extension\RuntimeExtensionInterface;
class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
{
private Request $request;
public function __constructor(Request $req)
public function setRequest(Request $req)
{
$this->request = $req;
}
@@ -103,19 +103,6 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
return $styles;
}
// ----------------------------------------------------------
// Request is not a service, can't find a better way to get it
public function onKernelRequest(RequestEvent $event)
{
$this->request = $event->getRequest();
}
public static function getSubscribedEvents()
{
return [KernelEvents::REQUEST => 'onKernelRequest'];
}
/**
* Renders the Svg Icon template and returns it.
*
@@ -142,4 +129,17 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
return '';
}
}
// ----------------------------------------------------------
// Request is not a service, can't find a better way to get it
public function onKernelRequest(RequestEvent $event)
{
$this->request = $event->getRequest();
}
public static function getSubscribedEvents()
{
return [KernelEvents::REQUEST => 'onKernelRequest'];
}
}