function ViewsHandlerTestFileSize::testFieldFileSize
File
-
tests/
handlers/ views_handler_field_file_size.test, line 52
Class
- ViewsHandlerTestFileSize
- Tests the core views_handler_field_file_size handler.
Code
public function testFieldFileSize() {
$view = $this->getBasicView();
$view->display['default']->handler
->override_option('fields', array(
'age' => array(
'id' => 'age',
'table' => 'views_test',
'field' => 'age',
),
));
$this->executeView($view);
// Test with the formatted option.
$this->assertEqual($view->field['age']
->advanced_render($view->result[0]), '');
$this->assertEqual($view->field['age']
->advanced_render($view->result[1]), '10 bytes');
$this->assertEqual($view->field['age']
->advanced_render($view->result[2]), '1000 bytes');
$this->assertEqual($view->field['age']
->advanced_render($view->result[3]), '9.77 KB');
// Test with the bytes option.
$view->field['age']->options['file_size_display'] = 'bytes';
$this->assertEqual($view->field['age']
->advanced_render($view->result[0]), '');
$this->assertEqual($view->field['age']
->advanced_render($view->result[1]), 10);
$this->assertEqual($view->field['age']
->advanced_render($view->result[2]), 1000);
$this->assertEqual($view->field['age']
->advanced_render($view->result[3]), 10000);
}