private function UiTest::assertThatAdminCanEditFrontEndEnvironment in Build Hooks 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/UiTest.php \Drupal\Tests\build_hooks\Functional\UiTest::assertThatAdminCanEditFrontEndEnvironment()
Tests editing an environment.
Parameters
\Drupal\build_hooks\Entity\FrontendEnvironmentInterface $environment: Environment.
Return value
\Drupal\build_hooks\Entity\FrontendEnvironmentInterface Edited entity.
1 call to UiTest::assertThatAdminCanEditFrontEndEnvironment()
- UiTest::testBuildHooksUi in tests/
src/ Functional/ UiTest.php - Test build hooks UI.
File
- tests/
src/ Functional/ UiTest.php, line 204
Class
- UiTest
- Defines a class for testing build hooks UI.
Namespace
Drupal\Tests\build_hooks\FunctionalCode
private function assertThatAdminCanEditFrontEndEnvironment(FrontendEnvironmentInterface $environment) : FrontendEnvironmentInterface {
$this
->drupalGet($environment
->toUrl('edit-form'));
$assert = $this
->assertSession();
$assert
->statusCodeEquals(200);
$new_name = $this
->randomMachineName();
$this
->submitForm([
'label' => $new_name,
], 'Save');
$assert
->pageTextContains('The frontend environment configuration has been saved.');
$environment = \Drupal::entityTypeManager()
->getStorage('frontend_environment')
->loadUnchanged($environment
->id());
$this
->assertNotEmpty($environment);
$this
->assertEquals($new_name, $environment
->label());
return $environment;
}