security update core+modules

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-26 18:38:56 +02:00
parent 2f45ea820a
commit 7c96373038
1022 changed files with 30319 additions and 11259 deletions

View File

@@ -66,11 +66,43 @@ class ViewsHandlerFieldBooleanTest extends ViewsSqlTest {
$this->assertEqual('✖', $view->field['age']->advanced_render($view->result[0]));
$this->assertEqual('✔', $view->field['age']->advanced_render($view->result[1]));
// Set a custom output format.
// Set a custom output format programmatically.
$view->field['age']->formats['test'] = array(t('Test-True'), t('Test-False'));
$view->field['age']->options['type'] = 'test';
$this->assertEqual(t('Test-False'), $view->field['age']->advanced_render($view->result[0]));
$this->assertEqual(t('Test-True'), $view->field['age']->advanced_render($view->result[1]));
// Set a custom output format through the UI using plain-text inputs.
$view->field['age']->options['type'] = 'custom';
$values = array(
'false' => 'Nay',
'true' => 'Yay',
);
$view->field['age']->options['type_custom_false'] = $values['false'];
$view->field['age']->options['type_custom_true'] = $values['true'];
$this->assertEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
$this->assertEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
// Set a custom output format through the UI using valid HTML inputs.
$view->field['age']->options['type'] = 'custom';
$values = array(
'false' => '<div class="bar">Nay</div>',
'true' => '<div class="foo">Yay</div>',
);
$view->field['age']->options['type_custom_false'] = $values['false'];
$view->field['age']->options['type_custom_true'] = $values['true'];
$this->assertEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
$this->assertEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
// Set a custom output format through the UI using unsafe inputs.
$view->field['age']->options['type'] = 'custom';
$values = array(
'false' => '<script>alert("Nay");</script>',
'true' => '<script>alert("Yay");</script>',
);
$view->field['age']->options['type_custom_false'] = $values['false'];
$view->field['age']->options['type_custom_true'] = $values['true'];
$this->assertNotEqual($values['false'], $view->field['age']->advanced_render($view->result[0]));
$this->assertNotEqual($values['true'], $view->field['age']->advanced_render($view->result[1]));
}
}

View File

@@ -34,6 +34,8 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
'relationship' => 'none',
// c is iso 8601 date format @see http://php.net/manual/en/function.date.php
'custom_date_format' => 'c',
'second_date_format' => 'custom',
'second_date_format_custom' => 'c',
),
));
$time = gmmktime(0, 0, 0, 1, 1, 2000);
@@ -51,6 +53,8 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
'medium' => format_date($time, 'medium', '', $timezone),
'large' => format_date($time, 'large', '', $timezone),
'custom' => format_date($time, 'custom', 'c', $timezone),
'today time ago custom' => format_date($time, 'custom', 'c', $timezone),
'today time ago' => t('%time ago', array('%time' => format_interval(120, 2))),
);
$this->assertRenderedDatesEqual($view, $dates, $timezone);
}
@@ -67,6 +71,17 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) {
foreach ($map as $date_format => $expected_result) {
$check_result_number = 0;
// If it's "today time ago" format we have to check the 6th element.
if ($date_format == 'today time ago') {
$check_result_number = 5;
}
// Correct the date format.
if ($date_format == 'today time ago custom') {
$date_format = 'today time ago';
}
$view->field['created']->options['date_format'] = $date_format;
$t_args = array(
'%value' => $expected_result,
@@ -80,8 +95,23 @@ class ViewsHandlerFieldDateTest extends ViewsSqlTest {
else {
$message = t('Value %value in %format format matches.', $t_args);
}
$actual_result = $view->field['created']->advanced_render($view->result[0]);
$actual_result = $view->field['created']->advanced_render($view->result[$check_result_number]);
$this->assertEqual($expected_result, $actual_result, $message);
}
}
/**
* Appends dataSet() with a data row for "today time ago" format testing.
*/
protected function dataSet() {
$data = parent::dataSet();
$data[] = array(
'name' => 'David',
'age' => 25,
'job' => 'Singer',
'created' => REQUEST_TIME - 120,
);
return $data;
}
}

View File

@@ -0,0 +1,66 @@
<?php
/**
* @file
* Definition of ViewsHandlerFileExtensionTest.
*/
/**
* Tests the views_handler_field_file_extension handler.
*/
class ViewsHandlerFileExtensionTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Field: File extension',
'description' => 'Test the views_handler_field_file_extension handler.',
'group' => 'Views Handlers',
);
}
function dataSet() {
$data = parent::dataSet();
$data[0]['name'] = 'file.png';
$data[1]['name'] = 'file.tar';
$data[2]['name'] = 'file.tar.gz';
$data[3]['name'] = 'file';
return $data;
}
function viewsData() {
$data = parent::viewsData();
$data['views_test']['name']['field']['handler'] = 'views_handler_field_file_extension';
$data['views_test']['name']['real field'] = 'name';
return $data;
}
/**
* Tests the 'extension_detect_tar' handler option.
*/
public function testFileExtensionTarOption() {
$view = $this->getBasicView();
$view->display['default']->handler->override_option('fields', array(
'name' => array(
'id' => 'name',
'table' => 'views_test',
'field' => 'name',
),
));
$this->executeView($view);
// Test without the tar option.
$this->assertEqual($view->field['name']->advanced_render($view->result[0]), 'png');
$this->assertEqual($view->field['name']->advanced_render($view->result[1]), 'tar');
$this->assertEqual($view->field['name']->advanced_render($view->result[2]), 'gz');
$this->assertEqual($view->field['name']->advanced_render($view->result[3]), '');
// Test with the tar option.
$view->field['name']->options['extension_detect_tar'] = TRUE;
$this->assertEqual($view->field['name']->advanced_render($view->result[0]), 'png');
$this->assertEqual($view->field['name']->advanced_render($view->result[1]), 'tar');
$this->assertEqual($view->field['name']->advanced_render($view->result[2]), 'tar.gz');
$this->assertEqual($view->field['name']->advanced_render($view->result[3]), '');
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* @file
* Contains ViewsHandlerTest.
*/
/**
* Tests generic handler functionality.
*
* @see view
*/
class ViewsHandlerTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Handlers',
'description' => 'Tests generic handler functionality.',
'group' => 'Views Handlers',
);
}
/**
* {@inheritdoc}
*/
protected function viewsData() {
$views_data = parent::viewsData();
$views_data['views']['test_access'] = array(
'title' => 'test access',
'help' => '',
'area' => array(
'handler' => 'views_test_area_access',
),
);
return $views_data;
}
/**
* Tests access for handlers using an area handler.
*/
public function testHandlerAccess() {
$view = $this->getBasicView();
// add a test area
$view->display['default']->handler->override_option('header', array(
'test_access' => array(
'id' => 'test_access',
'table' => 'views',
'field' => 'test_access',
'custom_access' => FALSE,
),
));
$view->init_display();
$view->init_handlers();
$handlers = $view->display_handler->get_handlers('header');
$this->assertEqual(0, count($handlers));
$view->destroy();
$view = $this->getBasicView();
// add a test area
$view->display['default']->handler->override_option('header', array(
'test_access' => array(
'id' => 'test_access',
'table' => 'views',
'field' => 'test_access',
'custom_access' => TRUE,
),
));
$view->init_display();
$view->init_handlers();
$handlers = $view->display_handler->get_handlers('header');
$this->assertEqual(1, count($handlers));
$this->assertTrue(isset($handlers['test_access']));
}
}