rater/tests/Integration/Subject/AddSubjectTest.php

32 lines
829 B
PHP
Raw Normal View History

2026-06-02 18:53:17 +02:00
<?php
2026-06-03 00:26:03 +02:00
namespace App\Tests\Integration\Subject;
2026-06-02 18:53:17 +02:00
2026-06-02 22:01:42 +02:00
use App\Entity\Restaurant;
use App\Repository\SubjectRepository;
2026-06-02 18:53:17 +02:00
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
2026-06-03 00:26:03 +02:00
class AddSubjectTest extends WebTestCase
2026-06-02 18:53:17 +02:00
{
2026-06-02 22:01:42 +02:00
public function testAddingNewSubject(): void
2026-06-02 18:53:17 +02:00
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
2026-06-02 22:01:42 +02:00
$client->submitForm('form_save', ['form[name]' => 'Riviera']);
$this->assertResponseRedirects();
2026-06-02 23:39:23 +02:00
$crawler = $client->followRedirect();
2026-06-02 22:01:42 +02:00
$subject = static::getContainer()
->get(SubjectRepository::class)
->findOneBy(['name' => 'Riviera']);
$this->assertNotNull($subject);
$this->assertInstanceOf(Restaurant::class, $subject);
2026-06-02 23:39:23 +02:00
$this->assertSelectorTextContains('ul li', 'Riviera');
2026-06-02 18:53:17 +02:00
}
}