updated etxlink, ctools, colorbox, computed_field

This commit is contained in:
2019-05-13 17:51:14 +02:00
parent 33210e10f2
commit 2ffad14939
309 changed files with 4930 additions and 2655 deletions

View File

@@ -1,26 +1,43 @@
<?php
/**
* @file
* Tests for different parts of the ctools plugin system.
*/
/**
* Test menu links depending on user permissions.
*/
class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Get plugin info',
'description' => 'Verify that plugin type definitions can properly set and overide values.',
'group' => 'ctools',
'dependencies' => array('ctools'),
);
}
function setUp() {
// Additionally enable contact module.
parent::setUp('ctools', 'ctools_plugin_test');
/**
* {@inheritdoc}
*/
public function setUp(array $modules = array()) {
$modules[] = 'ctools';
$modules[] = 'ctools_plugin_test';
parent::setUp($modules);
}
/**
* Assert helper to check that a specific plugin function exists.
*
* @param $module
* The module that owns the plugin.
* @param $type
* The type of plugin.
* @param $id
* The id of the specific plugin to load.
* @param $function
* The identifier of the function. For example, 'settings form'.
*/
protected function assertPluginFunction($module, $type, $id, $function = 'function') {
$func = ctools_plugin_load_function($module, $type, $id, $function);
$this->assertTrue(function_exists($func), t('Plugin @plugin of plugin type @module:@type successfully retrieved @retrieved for @function.', array(
@@ -32,6 +49,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
)));
}
/**
* Assert helper to check that a specific plugin function does NOT exist.
*
* @param $module
* The module that owns the plugin.
* @param $type
* The type of plugin.
* @param $id
* The id of the specific plugin to load.
* @param $function
* The identifier of the function. For example, 'settings form'.
*/
protected function assertPluginMissingFunction($module, $type, $id, $function = 'function') {
$func = ctools_plugin_load_function($module, $type, $id, $function);
$this->assertEqual($func, NULL, t('Plugin @plugin of plugin type @module:@type for @function with missing function successfully failed.', array(
@@ -42,6 +71,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
)));
}
/**
* Assert helper to check that a plugin can be loaded using a named class.
*
* @param $module
* The module that owns the plugin.
* @param $type
* The type of plugin.
* @param $id
* The id of the specific plugin to load.
* @param string $class
* The name of the PHP class to load.
*/
protected function assertPluginClass($module, $type, $id, $class = 'handler') {
$class_name = ctools_plugin_load_class($module, $type, $id, $class);
$this->assertTrue(class_exists($class_name), t('Plugin @plugin of plugin type @module:@type successfully retrieved @retrieved for @class.', array(
@@ -53,6 +94,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
)));
}
/**
* Assert helper to check that a plugin DOES NOT contain the named class.
*
* @param $module
* The module that owns the plugin.
* @param $type
* The type of plugin.
* @param $id
* The id of the specific plugin to load.
* @param string $class
* The name of the PHP class to load.
*/
protected function assertPluginMissingClass($module, $type, $id, $class = 'handler') {
$class_name = ctools_plugin_load_class($module, $type, $id, $class);
$this->assertEqual($class_name, NULL, t('Plugin @plugin of plugin type @module:@type for @class with missing class successfully failed.', array(
@@ -66,7 +119,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
/**
* Test that plugins are loaded correctly.
*/
function testPluginLoading() {
public function testPluginLoading() {
ctools_include('plugins');
$module = 'ctools_plugin_test';
$type = 'not_cached';
@@ -81,7 +134,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
$this->assertPluginClass($module, $type, 'plugin_array', 'handler');
$this->assertPluginClass($module, $type, 'plugin_array2', 'handler');
$this->assertPluginMissingClass($module, $type, 'plugin_array_dne', 'handler');
// TODO Test big hook plugins.
// @todo Test big hook plugins.
$type = 'cached';
@@ -95,6 +148,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase {
$this->assertPluginClass($module, $type, 'plugin_array', 'handler');
$this->assertPluginClass($module, $type, 'plugin_array2', 'handler');
$this->assertPluginMissingClass($module, $type, 'plugin_array_dne', 'handler');
// TODO Test big hook plugins.
// @todo Test big hook plugins.
}
}