Improved code style of tests

This commit is contained in:
Jan Böhmer 2023-06-11 15:02:59 +02:00
parent 5629215ce4
commit 684334ba22
73 changed files with 196 additions and 38 deletions

View file

@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\AttachmentTypeControllerTest
*/
#[Route(path: '/attachment_type')]
class AttachmentTypeController extends BaseAdminController
{

View file

@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\CategoryControllerTest
*/
#[Route(path: '/category')]
class CategoryController extends BaseAdminController
{

View file

@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\FootprintControllerTest
*/
#[Route(path: '/footprint')]
class FootprintController extends BaseAdminController
{

View file

@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\LabelProfileControllerTest
*/
#[Route(path: '/label_profile')]
class LabelProfileController extends BaseAdminController
{

View file

@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\ManufacturerControllerTest
*/
#[Route(path: '/manufacturer')]
class ManufacturerController extends BaseAdminController
{

View file

@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\MeasurementUnitControllerTest
*/
#[Route(path: '/measurement_unit')]
class MeasurementUnitController extends BaseAdminController
{

View file

@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\StorelocationControllerTest
*/
#[Route(path: '/store_location')]
class StorelocationController extends BaseAdminController
{

View file

@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @see \App\Tests\Controller\AdminPages\SupplierControllerTest
*/
#[Route(path: '/supplier')]
class SupplierController extends BaseAdminController
{

View file

@ -97,7 +97,7 @@ class PartListsController extends AbstractController
$attrs['disabled'] = $disabled;
$parent = $form->getParent();
if (!$parent instanceof \Symfony\Component\Form\FormInterface) {
if (!$parent instanceof FormInterface) {
throw new \RuntimeException('This function can only be used on form fields that are children of another form!');
}

View file

@ -30,6 +30,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @see \App\Tests\Controller\RedirectControllerTest
*/
class RedirectController extends AbstractController
{
public function __construct(protected string $default_locale, protected TranslatorInterface $translator, protected bool $enforce_index_php)
@ -55,7 +58,7 @@ class RedirectController extends AbstractController
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable())
&& !str_contains($new_url, 'index.php')) {
&& !str_contains((string) $new_url, 'index.php')) {
//Like Request::getUriForPath only with index.php
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
}