public function Example1Test::testExample1BlockAppears in Decoupled Blocks: Vue.js 8
Test that the Vue Example 1 block displays.
File
- tests/
src/ Functional/ Example1Test.php, line 46
Class
- Example1Test
- Test the vue_example_1 component.
Namespace
Drupal\Tests\pdb_vue\FunctionalCode
public function testExample1BlockAppears() {
$assert = $this
->assertSession();
$config = $this
->config('pdb_vue.settings');
// Set the values the user submitted in the form.
$config
->set('version', 'vue2');
$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('Vue Example 1');
// Place the "Vue Example 1" block.
$this
->drupalPlaceBlock('vue_component:vue_example_1');
// Go to the home page.
$this
->drupalGet('<front>');
// Assert that the block was placed and has the correct class.
$assert
->responseContains('vue-example-1');
// Check that the vue.js library was added.
$assert
->responseContains('//cdnjs.cloudflare.com/ajax/libs/vue/');
$assert
->responseContains('vue-example-1.js');
}