Files
e-ticket/tests/Repository/UserRepositoryTest.php
Serreau Jovann af8bbc24dc Add homepage, tarifs, legal pages, navbar, footer and full test coverage
- Homepage: hero, how it works (buyer/organizer), features, CTA
- Tarifs: 3 plans (Gratuit, Basique 10€, Sur-mesure), JSON-LD Product
- Legal pages: mentions legales, CGU (tabs buyer/organizer), CGV, RGPD, cookies, hosting
- Navbar: neubrutalism style, logo liip, mobile menu, SEO attributes
- Footer: contact, description, legal links, tarifs
- Sitemap: add /tarifs and /sitemap-orgas-{page}.xml
- Liip Imagine: remove S3, webp format on all filters
- Tests: full coverage for all controllers, services, repositories
- Fix CSP: replace inline onclick with data-tab JS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 00:01:58 +01:00

53 lines
1.5 KiB
PHP

<?php
namespace App\Tests\Repository;
use App\Entity\User;
use App\Repository\UserRepository;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
class UserRepositoryTest extends KernelTestCase
{
private UserRepository $repository;
protected function setUp(): void
{
self::bootKernel();
$this->repository = static::getContainer()->get(UserRepository::class);
}
public function testUpgradePasswordUpdatesUser(): void
{
$em = static::getContainer()->get('doctrine.orm.entity_manager');
$user = new User();
$user->setEmail('test-upgrade-'.uniqid().'@example.com');
$user->setFirstName('Test');
$user->setLastName('User');
$user->setPassword('old-hash');
$em->persist($user);
$em->flush();
$this->repository->upgradePassword($user, 'new-hash');
$em->refresh($user);
self::assertSame('new-hash', $user->getPassword());
}
public function testUpgradePasswordThrowsForUnsupportedUser(): void
{
$this->expectException(UnsupportedUserException::class);
$fakeUser = new class () implements PasswordAuthenticatedUserInterface {
public function getPassword(): ?string
{
return null;
}
};
$this->repository->upgradePassword($fakeUser, 'hash');
}
}