Fix test failures: correct ids format and anonymous access assertion

This commit is contained in:
Sebastian Almberg 2026-02-12 22:27:01 +01:00
parent be2c990286
commit 7e3aa7fed8
4 changed files with 10 additions and 9 deletions

View file

@ -12,7 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;
class PopulateKicadCommandTest extends KernelTestCase
final class PopulateKicadCommandTest extends KernelTestCase
{
private CommandTester $commandTester;
private EntityManagerInterface $entityManager;

View file

@ -28,7 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
#[Group("slow")]
#[Group("DB")]
class BatchEdaControllerTest extends WebTestCase
final class BatchEdaControllerTest extends WebTestCase
{
private function loginAsUser($client, string $username): void
{
@ -48,8 +48,8 @@ class BatchEdaControllerTest extends WebTestCase
$client = static::createClient();
$this->loginAsUser($client, 'admin');
// Request with part IDs in session — the page expects ids[] query param
$client->request('GET', '/en/tools/batch_eda_edit', ['ids' => [1, 2, 3]]);
// Request with part IDs as comma-separated string (controller uses getString)
$client->request('GET', '/en/tools/batch_eda_edit', ['ids' => '1,2,3']);
self::assertResponseIsSuccessful();
}
@ -71,7 +71,7 @@ class BatchEdaControllerTest extends WebTestCase
$this->loginAsUser($client, 'admin');
// Load the form page first
$crawler = $client->request('GET', '/en/tools/batch_eda_edit', ['ids' => [1, 2]]);
$crawler = $client->request('GET', '/en/tools/batch_eda_edit', ['ids' => '1,2']);
self::assertResponseIsSuccessful();

View file

@ -26,7 +26,7 @@ use App\DataFixtures\APITokenFixtures;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class KiCadApiV2ControllerTest extends WebTestCase
final class KiCadApiV2ControllerTest extends WebTestCase
{
private const BASE_URL = '/en/kicad-api/v2';
@ -170,7 +170,8 @@ class KiCadApiV2ControllerTest extends WebTestCase
$client = static::createClient();
$client->request('GET', self::BASE_URL.'/categories.json');
// Should redirect to login (302) since not authenticated
self::assertResponseRedirects();
// Anonymous user has default read permissions in Part-DB,
// so this returns 200 rather than a redirect
self::assertResponseIsSuccessful();
}
}

View file

@ -35,7 +35,7 @@ use PHPUnit\Framework\Attributes\Group;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
#[Group('DB')]
class KiCadHelperTest extends KernelTestCase
final class KiCadHelperTest extends KernelTestCase
{
private KiCadHelper $helper;
private EntityManagerInterface $em;