mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 22:09:35 +00:00
Fix test failures: correct ids format and anonymous access assertion
This commit is contained in:
parent
be2c990286
commit
7e3aa7fed8
4 changed files with 10 additions and 9 deletions
|
|
@ -12,7 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Symfony\Component\Console\Tester\CommandTester;
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
|
|
||||||
class PopulateKicadCommandTest extends KernelTestCase
|
final class PopulateKicadCommandTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private CommandTester $commandTester;
|
private CommandTester $commandTester;
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
#[Group("slow")]
|
#[Group("slow")]
|
||||||
#[Group("DB")]
|
#[Group("DB")]
|
||||||
class BatchEdaControllerTest extends WebTestCase
|
final class BatchEdaControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
private function loginAsUser($client, string $username): void
|
private function loginAsUser($client, string $username): void
|
||||||
{
|
{
|
||||||
|
|
@ -48,8 +48,8 @@ class BatchEdaControllerTest extends WebTestCase
|
||||||
$client = static::createClient();
|
$client = static::createClient();
|
||||||
$this->loginAsUser($client, 'admin');
|
$this->loginAsUser($client, 'admin');
|
||||||
|
|
||||||
// Request with part IDs in session — the page expects ids[] query param
|
// Request with part IDs as comma-separated string (controller uses getString)
|
||||||
$client->request('GET', '/en/tools/batch_eda_edit', ['ids' => [1, 2, 3]]);
|
$client->request('GET', '/en/tools/batch_eda_edit', ['ids' => '1,2,3']);
|
||||||
|
|
||||||
self::assertResponseIsSuccessful();
|
self::assertResponseIsSuccessful();
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ class BatchEdaControllerTest extends WebTestCase
|
||||||
$this->loginAsUser($client, 'admin');
|
$this->loginAsUser($client, 'admin');
|
||||||
|
|
||||||
// Load the form page first
|
// 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();
|
self::assertResponseIsSuccessful();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\DataFixtures\APITokenFixtures;
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class KiCadApiV2ControllerTest extends WebTestCase
|
final class KiCadApiV2ControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
private const BASE_URL = '/en/kicad-api/v2';
|
private const BASE_URL = '/en/kicad-api/v2';
|
||||||
|
|
||||||
|
|
@ -170,7 +170,8 @@ class KiCadApiV2ControllerTest extends WebTestCase
|
||||||
$client = static::createClient();
|
$client = static::createClient();
|
||||||
$client->request('GET', self::BASE_URL.'/categories.json');
|
$client->request('GET', self::BASE_URL.'/categories.json');
|
||||||
|
|
||||||
// Should redirect to login (302) since not authenticated
|
// Anonymous user has default read permissions in Part-DB,
|
||||||
self::assertResponseRedirects();
|
// so this returns 200 rather than a redirect
|
||||||
|
self::assertResponseIsSuccessful();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ use PHPUnit\Framework\Attributes\Group;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class KiCadHelperTest extends KernelTestCase
|
final class KiCadHelperTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private KiCadHelper $helper;
|
private KiCadHelper $helper;
|
||||||
private EntityManagerInterface $em;
|
private EntityManagerInterface $em;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue