function SimpleTestUnitTestExampleTestCase::testSimpleTestUnitTestExampleFunction
Test simpletest_example_empty_mysql_date().
Note that no environment is provided; we're just testing the correct behavior of a function when passed specific arguments.
File
-
simpletest_example/
simpletest_example.test, line 173
Class
- SimpleTestUnitTestExampleTestCase
- Although most core test cases are based on DrupalWebTestCase and are functional tests (exercising the web UI) we also have DrupalUnitTestCase, which executes much faster because a Drupal install does not have to be one. No environment is provided to a…
Code
public function testSimpleTestUnitTestExampleFunction() {
$result = simpletest_example_empty_mysql_date(NULL);
// Note that test assertion messages should never be translated, so
// this string is not wrapped in t().
$message = 'A NULL value should return TRUE.';
$this->assertTrue($result, $message);
$result = simpletest_example_empty_mysql_date('');
$message = 'An empty string should return TRUE.';
$this->assertTrue($result, $message);
$result = simpletest_example_empty_mysql_date('0000-00-00');
$message = 'An "empty" MySQL DATE should return TRUE.';
$this->assertTrue($result, $message);
$result = simpletest_example_empty_mysql_date(date('Y-m-d'));
$message = 'A valid date should return FALSE.';
$this->assertFalse($result, $message);
}