rater/tests/Integration/Controller/SubjectControllerTest.php

28 lines
728 B
PHP
Raw Normal View History

2026-06-02 18:53:17 +02:00
<?php
namespace App\Tests\Integration\Controller;
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;
class SubjectControllerTest 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();
$subject = static::getContainer()
->get(SubjectRepository::class)
->findOneBy(['name' => 'Riviera']);
$this->assertNotNull($subject);
$this->assertInstanceOf(Restaurant::class, $subject);
2026-06-02 18:53:17 +02:00
}
}