public function Example1Test::testExample1V3BlockAppears in Decoupled Blocks: Vue.js 8
Test that the Vue3 Example 1 block displays.
File
- tests/
src/ Functional/ Example1Test.php, line 82
Class
- Example1Test
- Test the vue_example_1 component.
Namespace
Drupal\Tests\pdb_vue\FunctionalCode
public function testExample1V3BlockAppears() {
$assert = $this
->assertSession();
$config = $this
->config('pdb_vue.settings');
// Set the values the user submitted in the form.
$config
->set('version', 'vue3');
$config
->set('development_mode', TRUE);
$config
->save();
// Create administrative user.
$this
->drupalLogin($this
->drupalCreateUser([
'access administration pages',
'administer blocks',
]));
// Check that the Vue Example Block is available.
$this
->drupalGet('admin/structure/block/library/stark');
$assert
->responseContains('Vue3 Example 1');
// Place the "Vue Example 1" block.
$this
->drupalPlaceBlock('vue_component:vue3_example_1');
// Go to the home page.
$this
->drupalGet('<front>');
// Assert that the block was placed and has the correct class.
$assert
->responseContains('vue3-example-1');
// Check that the vue.js library was added.
$assert
->responseContains('//cdn.jsdelivr.net/npm/vue@3');
$assert
->responseContains('vue3-example-1.js');
}