first import
This commit is contained in:
126
sites/all/modules/openlayers/tests/openlayers_test.module
Normal file
126
sites/all/modules/openlayers/tests/openlayers_test.module
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Main OpenLayers Test Module file
|
||||
*
|
||||
* This file contains a test module to help with automated
|
||||
* testing.
|
||||
*
|
||||
* @ingroup openlayers
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function openlayers_test_menu() {
|
||||
$items = array();
|
||||
|
||||
$items['admin/structure/openlayers/test'] = array(
|
||||
'title' => 'Tests',
|
||||
'description' => 'Test Pages for OpenLayers.',
|
||||
'page callback' => 'openlayers_test_show_maps',
|
||||
'access arguments' => array('administer openlayers'),
|
||||
'file' => 'includes/openlayers_test.pages.inc',
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'weight' => 9999,
|
||||
);
|
||||
$items['admin/structure/openlayers/test/list'] = array(
|
||||
'title' => 'Show Maps',
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||
'weight' => -20,
|
||||
);
|
||||
$items['admin/structure/openlayers/test/js'] = array(
|
||||
'title' => 'JS Tests',
|
||||
'description' => 'Test Pages for OpenLayers Javascript.',
|
||||
'page callback' => 'openlayers_test_js',
|
||||
'access arguments' => array('administer openlayers'),
|
||||
'file' => 'includes/openlayers_test.pages.inc',
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'weight' => -10,
|
||||
);
|
||||
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_api().
|
||||
*/
|
||||
function openlayers_test_ctools_plugin_api($module, $api) {
|
||||
// Define plugins for OpenLayers plugins api
|
||||
if ($module == "openlayers") {
|
||||
switch ($api) {
|
||||
case 'openlayers_maps':
|
||||
return array('version' => 1);
|
||||
|
||||
case 'openlayers_layers':
|
||||
return array('version' => 1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_api().
|
||||
*/
|
||||
function openlayers_test_views_api() {
|
||||
return array(
|
||||
'api' => 2,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_openlayers_maps().
|
||||
*/
|
||||
function openlayers_test_openlayers_maps() {
|
||||
module_load_include('inc', 'openlayers_test', 'includes/openlayers_test.maps');
|
||||
return _openlayers_test_openlayers_maps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_openlayers_layers().
|
||||
*/
|
||||
function openlayers_test_openlayers_layers() {
|
||||
module_load_include('inc', 'openlayers_test', 'includes/openlayers_test.layers');
|
||||
return _openlayers_test_openlayers_layers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_default_views().
|
||||
*/
|
||||
function openlayers_test_views_default_views() {
|
||||
module_load_include('inc', 'openlayers_test', 'includes/openlayers_test.views');
|
||||
return _openlayers_test_views_default_views();
|
||||
}
|
||||
|
||||
/**
|
||||
* Impements hook_openlayers_map_preprocess_alter().
|
||||
*/
|
||||
function openlayers_test_openlayers_map_preprocess_alter(&$map) {
|
||||
// For testing purposes, display a message on the only the Test
|
||||
// page, and only once.
|
||||
static $performed = FALSE;
|
||||
if (!$performed && $_GET['q'] == 'admin/structure/openlayers/test') {
|
||||
drupal_set_message(t('OpenLayers preprocess map alter hook fired.'));
|
||||
$performed = TRUE;
|
||||
}
|
||||
|
||||
// Add stop render for JS testing
|
||||
if ($_GET['q'] == 'admin/structure/openlayers/test/js') {
|
||||
$map['stop_render'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Impements hook_openlayers_map_alter().
|
||||
*/
|
||||
function openlayers_test_openlayers_map_alter(&$map) {
|
||||
// For testing purposes, display a message on the only the Test
|
||||
// page, and only once.
|
||||
static $performed = FALSE;
|
||||
if (!$performed && $_GET['q'] == 'admin/structure/openlayers/test') {
|
||||
drupal_set_message(t('OpenLayers map alter hook fired.'));
|
||||
$performed = TRUE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user