Add coverage tests, extract breadcrumb constants, add thead to detail table, ignore css:S4662

- Add test for sitemap orgas with logo image coverage
- Add test for organizer settings with logo file upload
- Extract BREADCRUMB_HOME/BREADCRUMB_ACCOUNT constants in AccountController
- Extract BREADCRUMB_HOME/BREADCRUMB_ORGANIZERS constants in HomeController
- Extract BREADCRUMB_HOME/BREADCRUMB_REGISTER constants in RegistrationController
- Add thead with th headers to organizer detail info table
- Ignore SonarQube css:S4662 rule for assets (Tailwind @source directive)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 11:00:08 +01:00
parent c273fd1df4
commit c2169eb5e8
7 changed files with 87 additions and 15 deletions

View File

@@ -440,6 +440,33 @@ class AccountControllerTest extends WebTestCase
self::assertNull($em->getRepository(User::class)->find($subId));
}
public function testOrganizerSettingsWithLogoUpload(): void
{
$client = static::createClient();
$em = static::getContainer()->get(EntityManagerInterface::class);
$user = $this->createUser(['ROLE_ORGANIZER'], true);
$client->loginUser($user);
$logoFile = new \Symfony\Component\HttpFoundation\File\UploadedFile(
__DIR__.'/../../public/logo.png',
'logo.png',
'image/png',
null,
true,
);
$client->request('POST', '/mon-compte/parametres', [
'email' => $user->getEmail(),
'phone' => '0699887766',
], ['logo' => $logoFile]);
self::assertResponseRedirects('/mon-compte?tab=settings');
$em->refresh($user);
self::assertNotNull($user->getLogoName());
}
/**
* @param list<string> $roles
*/

View File

@@ -2,6 +2,8 @@
namespace App\Tests\Controller;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class SitemapControllerTest extends WebTestCase
@@ -42,4 +44,31 @@ class SitemapControllerTest extends WebTestCase
self::assertResponseIsSuccessful();
self::assertStringContainsString('text/xml', $client->getResponse()->headers->get('Content-Type'));
}
public function testSitemapOrgasIncludesLogoImage(): void
{
$client = static::createClient();
$em = static::getContainer()->get(EntityManagerInterface::class);
$organizer = new User();
$organizer->setEmail('test-sitemap-logo-'.uniqid().'@example.com');
$organizer->setFirstName('Logo');
$organizer->setLastName('Test');
$organizer->setPassword('hashed');
$organizer->setRoles(['ROLE_ORGANIZER']);
$organizer->setIsApproved(true);
$organizer->setIsVerified(true);
$organizer->setCompanyName('Asso Logo');
$organizer->setLogoName('test-logo.png');
$em->persist($organizer);
$em->flush();
$client->request('GET', '/sitemap-orgas-1.xml');
self::assertResponseIsSuccessful();
$content = $client->getResponse()->getContent();
self::assertStringContainsString('image:image', $content);
self::assertStringContainsString('test-logo.png', $content);
self::assertStringContainsString('Asso Logo', $content);
}
}