public function UiPatternsPreviewRenderTest::testPatternPreviewSuggestions in UI Patterns 8
Tests pattern preview suggestions.
File
- tests/
src/ Functional/ UiPatternsPreviewRenderTest.php, line 45
Class
- UiPatternsPreviewRenderTest
- Test pattern preview rendering.
Namespace
Drupal\Tests\ui_patterns\FunctionalCode
public function testPatternPreviewSuggestions() {
$assert_session = $this
->assertSession();
$this
->enableTwigDebugMode();
$user = $this
->drupalCreateUser([], NULL, TRUE);
$this
->drupalLogin($user);
$this
->drupalGet('/patterns');
// Assert correct variant suggestions.
$suggestions = [
'pattern-foo--variant-default--preview.html.twig',
'pattern-foo--variant-default.html.twig',
'pattern-foo--preview.html.twig',
'pattern-foo.html.twig',
'pattern-foo-bar--variant-default--preview.html.twig',
'pattern-foo-bar--variant-default.html.twig',
'pattern-foo-bar--preview.html.twig',
'pattern-foo-bar.html.twig',
];
foreach ($suggestions as $suggestion) {
$assert_session
->responseContains($suggestion);
}
}