You are here

public function TimeFieldUnitTest::testSimpletestUnitTestExampleFunction in Timefield 7

Check that timefield_field_is_empty work correctly

File

./timefield.test, line 207
Tests for timefield.

Class

TimeFieldUnitTest
Timefield Unit tests

Code

public function testSimpletestUnitTestExampleFunction() {
  $item = array();
  $result = timefield_field_is_empty($item, array());
  $message = t('Value index not set should return TRUE.');
  $this
    ->assertTrue($result, $message);
  $item['value'] = NULL;
  $result = timefield_field_is_empty($item, array());
  $message = t('A NULL value should return TRUE.');
  $this
    ->assertTrue($result, $message);
  $item['value'] = '';
  $result = timefield_field_is_empty($item, array());
  $message = t('An empty string should return TRUE.');
  $this
    ->assertTrue($result, $message);
  $item['value'] = 50;
  $result = timefield_field_is_empty($item, array());
  $message = t('A positive integer should return FALSE.');
  $this
    ->assertFalse($result, $message);
  $item['value'] = '0';
  $result = timefield_field_is_empty($item, array());
  $message = t('A string with a zero should return FALSE.');
  $this
    ->assertFalse($result, $message);
  $item['value'] = 0;
  $result = timefield_field_is_empty($item, array());
  $message = t('A zero should return FALSE.');
  $this
    ->assertFalse($result, $message);
}