You are here

TestContentTypeConfiguration.test in Configuration Management 7.2

Tests for Configuration Management: Content Types.

File

tests/handlers/TestContentTypeConfiguration.test
View source
<?php

/**
 * @file
 * Tests for Configuration Management: Content Types.
 */
class TestContentTypeConfiguration extends ConfigurationHandlerBaseTestCase {
  protected $content_type;

  /**
   * Test info.
   */
  public static function getInfo() {
    return array(
      'name' => t('Handler: ContentTypeConfiguration'),
      'description' => t('Test the configuration API for content types configurations'),
      'group' => t('Configuration'),
    );
  }

  /**
   * Returns an array of configurations to import.
   */
  protected function configToImport() {
    return array(
      'content_type.test',
    );
  }

  /**
   * Returns an array of configurations to export.
   */
  protected function configToExport() {
    return array(
      'content_type.' . $this->content_type->type,
    );
  }

  /**
   * Returns an array of configurations to modify and check for modifications.
   */
  protected function configToModify() {
    return array(
      'content_type.test',
    );
  }

  /**
   * Return TRUE if the configuration is modified in the active store.
   */
  protected function isModified($config) {
    $modified = FALSE;
    $content_type = node_type_load('test');
    $modified = $content_type->name == 'modified';
    $modified = $content_type->description == 'description modified';
    return $modified;
  }

  /**
   * Return TRUE if all the configurations defined in configToImport were saved
   * into the active store.
   */
  protected function savedInActiveStore() {
    $content_type = node_type_load('test');
    return !empty($content_type);
  }

  /**
   * This function creates the configurations that will be exported by
   * configuration management.
   */
  protected function createConfigToExport() {
    $this->content_type = $this
      ->drupalCreateContentType();
  }

  /**
   * Perform changes in the configuration and save those changes into the active
   * store.
   */
  protected function modifyConfiguration() {
    $content_type = node_type_load('test');
    $content_type->name = 'modified';
    $content_type->description = 'description modified';
    node_type_save($content_type);
  }

}

Classes

Namesort descending Description
TestContentTypeConfiguration @file Tests for Configuration Management: Content Types.