FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,103 @@
<?php
/**
* @file
* Tests for the Features Extra Block module.
*/
/**
* Tests the functionality of FE Block.
*/
class FeaturesExtraBlockTestCase extends FeaturesExtraTestCase {
// The installation profile that will be used to run the tests.
protected $profile = 'testing';
// Stores a test block.
protected $block;
public static function getInfo() {
return array(
'name' => 'FE Block',
'description' => 'Tests Features integration for blocks and block settings.',
'group' => 'Features Extra',
);
}
/**
* Check that all modules that are required for the test suite are available.
*/
public function testRequiredModules() {
$required_modules = array(
'block',
'block_class',
'blockcache_alter',
'ctools',
'features',
'fe_block',
'features_extra_test',
);
foreach ($required_modules as $module) {
$this->assertTrue(module_exists($module), format_string('The required module @module exists.', array('@module' => $module)));
}
}
/**
* Test if custom blocks can be reverted and that overrides are detected.
*/
public function testBlockRevert() {
// Ensure that the exported custom block is properly available.
$bid = fe_block_get_bid('features_extra_test_block');
$this->block = block_load('block', $bid);
$this->assertTrue(!empty($this->block), 'The reverted block is present.');
$components = array(
'fe_block_boxes',
'fe_block_settings',
);
$this->revertComponents($components);
}
/**
* Change the content of the test block so the component becomes overridden.
*/
protected function override_fe_block_boxes() {
db_update('block_custom')
->fields(array('body' => 'overridden'))
->condition('bid', $this->block->bid)
->execute();
}
/**
* Change a setting of the test block so the component becomes overridden.
*/
protected function override_fe_block_settings() {
db_update('block')
->fields(array('region' => 'footer'))
->condition('bid', $this->block->bid)
->condition('theme', 'bartik')
->execute();
}
/**
* Tests the integration with the Block Class module.
*
* @see http://www.drupal.org/node/1342996
*/
public function testBlockClass() {
$this->drupalGet('<front>');
$this->assertRaw('test-class', 'The class set by the Block Class module has been found.');
}
/**
* Tests the integration with the Block Cache Alter module.
*
* @see http://www.drupal.org/node/1973926
*/
public function testBlockCacheAlter() {
$bid = fe_block_get_bid('features_extra_test_block');
$this->block = block_load('block', $bid);
$this->assertEqual($this->block->cache, DRUPAL_CACHE_GLOBAL, 'The test block uses the caching method set by the Block Cache Alter module.');
}
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* @file
* Tests for the Features Extra Nodequeue module.
*/
/**
* Tests the functionality of FE Nodequeue.
*/
class FeaturesExtraNodequeueTestCase extends FeaturesExtraTestCase {
// The installation profile that will be used to run the tests.
protected $profile = 'testing';
// Stores a test nodequeue.
protected $nodequeue;
public static function getInfo() {
return array(
'name' => 'FE Nodequeue',
'description' => 'Tests Features integration with the Nodequeue module.',
'group' => 'Features Extra',
);
}
/**
* Check that all modules that are required for the test suite are available.
*/
public function testRequiredModules() {
$required_modules = array(
'nodequeue',
'ctools',
'features',
'fe_nodequeue',
'features_extra_test',
);
foreach ($required_modules as $module) {
$this->assertTrue(module_exists($module), format_string('The required module @module exists.', array('@module' => $module)));
}
}
/**
* Test if nodequeues can be reverted and that overrides are detected.
*/
public function testNodequeueRevert() {
// Ensure that the exported nodequeue is properly available.
$this->nodequeue = _fe_nodequeue_load_queue_by_name('features_extra_test_nodequeue');
$this->assertTrue(!empty($this->nodequeue), 'The reverted nodequeue is present.');
$this->revertComponents(array('fe_nodequeue'));
}
/**
* Change the title of the test nodequeue so the component becomes overridden.
*/
protected function override_fe_nodequeue() {
$this->nodequeue->title = $this->randomString();
nodequeue_save($this->nodequeue);
// Reset static caches.
// Note: we are using a variant of nodequeue_get_qid_map() that uses
// drupal_static() instead of a static variable to cache the results.
// @see http://drupal.org/node/1666556
drupal_static_reset('_fe_nodequeue_get_qid_map');
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @file
* features_extra_test.features.fe_block_boxes.inc
*/
/**
* Implements hook_default_fe_block_boxes().
*/
function features_extra_test_default_fe_block_boxes() {
$export = array();
$fe_block_boxes = new stdClass();
$fe_block_boxes->info = 'Features Extra Test Block';
$fe_block_boxes->format = 'plain_text';
$fe_block_boxes->machine_name = 'features_extra_test_block';
$fe_block_boxes->body = 'This block is used in automated testing for the Features Extra module.';
$export['features_extra_test_block'] = $fe_block_boxes;
return $export;
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* @file
* features_extra_test.features.fe_block_settings.inc
*/
/**
* Implements hook_default_fe_block_settings().
*/
function features_extra_test_default_fe_block_settings() {
$export = array();
$export['version'] = '2.0';
$export['block-features_extra_test_block'] = array(
'cache' => 8,
'css_class' => 'test-class',
'custom' => '0',
'machine_name' => 'features_extra_test_block',
'module' => 'block',
'node_types' => array(),
'pages' => '',
'roles' => array(),
'themes' => array(
'bartik' => array(
'region' => 'content',
'status' => '1',
'theme' => 'bartik',
'weight' => '0',
),
),
'title' => 'Features Extra',
'visibility' => '0',
);
return $export;
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* @file
* features_extra_test.features.inc
*/
/**
* Implements hook_fe_nodequeue_export_fields().
*/
function features_extra_test_fe_nodequeue_export_fields() {
$nodequeues = array();
// Exported nodequeues: features_extra_test_nodequeue
$nodequeues['features_extra_test_nodequeue'] = array(
'name' => 'features_extra_test_nodequeue',
'title' => 'Features Extra Test Nodequeue',
'subqueue_title' => '',
'size' => '0',
'link' => '',
'link_remove' => '',
'owner' => 'nodequeue',
'show_in_ui' => '1',
'show_in_tab' => '1',
'show_in_links' => '0',
'reference' => '0',
'reverse' => '0',
'i18n' => '0',
'subqueues' => '1',
'types' => array(
0 => 'article',
),
'roles' => array(),
'count' => 0,
);
return $nodequeues;
}

View File

@@ -0,0 +1,22 @@
name = Features Extra test feature
description = Test feature for Features Extra.
core = 7.x
package = Testing
php = 5.2.4
dependencies[] = block_class
dependencies[] = blockcache_alter
dependencies[] = fe_block
dependencies[] = fe_nodequeue
features[fe_block_boxes][] = features_extra_test_block
features[fe_block_settings][] = block-features_extra_test_block
features[fe_nodequeue][] = features_extra_test_nodequeue
features[features_api][] = api:1
; Information added by drupal.org packaging script on 2013-09-30
version = "7.x-1.0-beta1+3-dev"
core = "7.x"
project = "features_extra"
datestamp = "1380578149"

View File

@@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Features Extra test feature feature.
*/
include_once 'features_extra_test.features.inc';

View File

@@ -0,0 +1,48 @@
<?php
/**
* @file
* Base class for Features Extra tests.
*/
class FeaturesExtraTestCase extends DrupalWebTestCase {
// The installation profile that will be used to run the tests.
protected $profile = 'testing';
public function setUp() {
// Enable the test feature in addition to given modules.
$modules = func_get_args();
$modules = !empty($modules[0]) ? $modules[0] : array();
$modules[] = 'features_extra_test';
parent::setUp($modules);
$admin_user = $this->drupalCreateUser(array('administer features'));
$this->drupalLogin($admin_user);
}
/**
* Test if components can be reverted and that overrides are detected.
*/
protected function revertComponents($components = array()) {
module_load_include('inc', 'features', 'features.export');
foreach ($components as $component) {
// Ensure that the component is in its default state initially.
$states = features_get_component_states(array('features_extra_test'), FALSE, TRUE);
$this->assertTrue($states['features_extra_test'][$component] === FEATURES_DEFAULT, t('@component state: Default.', array('@component' => $component)));
// Override component and test that Features detects the override.
$callback = "override_{$component}";
$this->$callback();
$states = features_get_component_states(array('features_extra_test'), FALSE, TRUE);
$this->assertTrue($states['features_extra_test'][$component] === FEATURES_OVERRIDDEN, t('@component state: Overridden.', array('@component' => $component)));
}
// Revert component and ensure that component has reverted.
features_revert(array('features_extra_test' => $components));
foreach ($components as $component) {
$states = features_get_component_states(array('features_extra_test'), FALSE, TRUE);
$this->assertTrue($states['features_extra_test'][$component] === FEATURES_DEFAULT, t('@component reverted successfully.', array('@component' => $component)));
}
}
}