YamlFormHandlerPluginTest.php in YAML Form 8        
                          
                  
                        
  
  
  
  
  
File
  src/Tests/YamlFormHandlerPluginTest.php
  
    View source  
  <?php
namespace Drupal\yamlform\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\yamlform\Entity\YamlForm;
class YamlFormHandlerPluginTest extends WebTestBase {
  
  protected static $modules = [
    'yamlform',
    'yamlform_devel',
  ];
  
  public function testYamlFormHandler() {
    $yamlform = YamlForm::load('contact');
    
    $this
      ->assertEqual($yamlform
      ->getDependencies(), [
      'module' => [
        'yamlform',
      ],
    ]);
    
    $yamlform_handler_configuration = [
      'id' => 'debug',
      'label' => 'Debug',
      'handler_id' => 'debug',
      'status' => 1,
      'weight' => 2,
      'settings' => [],
    ];
    $yamlform
      ->addYamlFormHandler($yamlform_handler_configuration);
    $yamlform
      ->save();
    
    $this
      ->assertEqual($yamlform
      ->getDependencies(), [
      'module' => [
        'yamlform_devel',
        'yamlform',
      ],
    ]);
    
    $this->container
      ->get('module_installer')
      ->uninstall([
      'yamlform_devel',
    ]);
    $yamlform = YamlForm::load('contact');
    
    $this
      ->assertNotEqual($yamlform
      ->getDependencies(), [
      'module' => [
        'yamlform_devel',
        'yamlform',
      ],
    ]);
    $this
      ->assertEqual($yamlform
      ->getDependencies(), [
      'module' => [
        'yamlform',
      ],
    ]);
  }
}