Created
February 7, 2023 19:44
-
-
Save AlexandreGerault/3ba643211549c01ff32e05c9979d632b to your computer and use it in GitHub Desktop.
Confusing error with EasyAdmin integration test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EditSchoolTest extends SchoolTestCase | |
{ | |
use ResetDatabase; | |
public function testItEditsASchool(): void | |
{ | |
$admin = $this->createAdmin(); | |
$school = $this->createSchool(); | |
$client = static::createClient(); | |
$client->loginUser($admin->object()); | |
$urlGenerator = $this->getAdminUrlGenerator(); | |
$url = $urlGenerator | |
->setController(SchoolCrudController::class) | |
->setAction('edit') | |
->setEntityId($school->id) | |
->generateUrl(); | |
$client->request('GET', $url); | |
self::assertResponseIsSuccessful(); | |
$crawler = $client->getCrawler(); | |
$form = $crawler->filter('form[name="School"]')->form(); | |
$client->submit($form, [ | |
'School' => [ | |
'name' => 'New name', | |
'website' => 'https://new-website.com', | |
'region' => 'New region', | |
'department' => 'New department', | |
'city' => 'New city', | |
'address' => 'New address', | |
'isPublic' => '1', | |
'foundationDate' => '2020-01-01', | |
'shortDescription' => 'New short description', | |
'longDescription' => 'New long description', | |
] | |
]); | |
self::assertResponseRedirects(); | |
$client->followRedirect(); | |
self::assertResponseIsSuccessful(); | |
SchoolFactory::assert()->exists([ | |
'name' => 'New name', | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment