Add logo upload to admin organizer edit page

Admin can now view the current logo and upload a new one via the
organizer edit form. Uses VichUploader with the existing organizer_logo
mapping. Adds test with fixture image.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-26 10:00:33 +01:00
parent fd1162b7af
commit d6ead88d3d
4 changed files with 66 additions and 1 deletions

View File

@@ -509,6 +509,42 @@ class AdminControllerTest extends WebTestCase
self::assertSame(0.5, $orga->getCommissionRate());
}
public function testEditOrganizerWithLogo(): void
{
$client = static::createClient();
$em = static::getContainer()->get(EntityManagerInterface::class);
$admin = $this->createUser(['ROLE_ROOT']);
$orga = $this->createOrganizer($em);
$orga->setIsApproved(true);
$orga->setOffer('basic');
$orga->setCommissionRate(3.0);
$em->flush();
$logo = new \Symfony\Component\HttpFoundation\File\UploadedFile(
__DIR__.'/../fixtures/logo.png',
'logo.png',
'image/png',
null,
true,
);
$client->loginUser($admin);
$client->request('POST', '/admin/organisateur/'.$orga->getId().'/modifier', [
'first_name' => $orga->getFirstName(),
'last_name' => $orga->getLastName(),
'email' => $orga->getEmail(),
'company_name' => $orga->getCompanyName(),
'siret' => $orga->getSiret(),
'offer' => 'basic',
'commission_rate' => '3',
], ['logo' => $logo]);
self::assertResponseRedirects('/admin/organisateurs?tab=approved');
$em->refresh($orga);
self::assertNotNull($orga->getLogoName());
}
public function testEditOrganizerRedirectsIfNotApproved(): void
{
$client = static::createClient();

BIN
tests/fixtures/logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 B