You are here

class PlugBasicTest in Plug 7

Hierarchy

  • class \Drupal\plug\Tests\PlugBasicTest extends \Drupal\plug\Tests\DrupalWebTestCase

Expanded class hierarchy of PlugBasicTest

File

lib/Drupal/plug/Tests/PlugBasicTest.php, line 12
Basic tests cases for plug module.

Namespace

Drupal\plug\Tests
View source
class PlugBasicTest extends \DrupalWebTestCase {

  /**
   * {@inheritdoc}
   */
  public static function getInfo() {
    return array(
      'name' => 'Plug tests',
      'description' => 'Plug basic tests',
      'group' => 'Plug',
    );
  }

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp('plug');
  }

  /**
   * Checks the Module::getModuleDirectories() method.
   */
  public function testModuleDirectories() {
    $expected_values = array(
      'plug' => drupal_get_path('module', 'plug'),
      'field' => 'modules/field',
      'field_sql_storage' => 'modules/field/modules/field_sql_storage',
      'filter' => 'modules/filter',
      'node' => 'modules/node',
      'user' => 'modules/user',
      'standard' => 'profiles/standard',
      'system' => 'modules/system',
    );
    $directories = Module::getDirectories();
    $this
      ->assertEqual($expected_values, array_intersect_assoc($directories, $expected_values));
    $cached_data = cache_get('module_directories');
    $this
      ->assertEqual($expected_values, array_intersect_assoc($cached_data->data, $expected_values));
  }

  /**
   * Checks the Module::getNamespaces() method.
   */
  public function testModuleNamespaces() {
    $expected_values = array(
      'Drupal\\plug' => drupal_get_path('module', 'plug') . '/src',
      'Drupal\\field' => 'modules/field/src',
      'Drupal\\field_sql_storage' => 'modules/field/modules/field_sql_storage/src',
      'Drupal\\filter' => 'modules/filter/src',
      'Drupal\\node' => 'modules/node/src',
      'Drupal\\user' => 'modules/user/src',
      'Drupal\\standard' => 'profiles/standard/src',
      'Drupal\\system' => 'modules/system/src',
    );
    $namespaces = Module::getNamespaces();
    $this
      ->assertEqual($expected_values, array_intersect_assoc($namespaces
      ->getArrayCopy(), $expected_values));
    $cached_data = cache_get('module_namespaces');
    $this
      ->assertEqual($expected_values, array_intersect_assoc($cached_data->data, $expected_values));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PlugBasicTest::getInfo public static function
PlugBasicTest::setUp public function
PlugBasicTest::testModuleDirectories public function Checks the Module::getModuleDirectories() method.
PlugBasicTest::testModuleNamespaces public function Checks the Module::getNamespaces() method.