YamlFormBlockTest.php in YAML Form 8
File
src/Tests/YamlFormBlockTest.php
View source
<?php
namespace Drupal\yamlform\Tests;
class YamlFormBlockTest extends YamlFormTestBase {
public function testBlock() {
$block = $this
->drupalPlaceBlock('yamlform_block');
$block
->getPlugin()
->setConfigurationValue('yamlform_id', 'contact');
$block
->save();
$this
->drupalGet('<front>');
$this
->assertRaw('yamlform-submission-contact-form');
$block
->getPlugin()
->setConfigurationValue('default_data', "name: 'John Smith'");
$block
->save();
$this
->drupalGet('<front>');
$this
->assertRaw('yamlform-submission-contact-form');
$this
->assertFieldByName('name', 'John Smith');
$block
->getPlugin()
->setConfigurationValue('yamlform_id', 'test_confirmation_inline');
$block
->save();
$this
->drupalPostForm('<front>', [], t('Submit'));
$this
->assertRaw('This is a custom inline confirmation message.');
$block
->getPlugin()
->setConfigurationValue('yamlform_id', 'test_confirmation_message');
$block
->save();
$this
->drupalPostForm('<front>', [], t('Submit'));
$this
->assertRaw('This is a <b>custom</b> confirmation message.');
}
}