public function realistic_dummy_content_UnitTestCase::testModule in Realistic Dummy Content 7
File
- api/
tests/ realistic_dummy_content_api.unit.test, line 58 - This file contains the testing code for this module
Class
- realistic_dummy_content_UnitTestCase
- The test case
Code
public function testModule() {
// only pure functions should be tested here. The database is not available.
$user = (object) array();
$user->mail = 'whatever@example.com.invalid';
$this
->assertTrue(realistic_dummy_content_api_realistic_dummy_content_api_dummy($user, 'user'), 'User with an email ending in .invalid is considered dummy content');
$user->mail = 'whatever@example.com';
$user->devel_generate = TRUE;
$this
->assertTrue(realistic_dummy_content_api_realistic_dummy_content_api_dummy($user, 'user'), 'User with the devel_generate property set is considered dummy content');
unset($user->devel_generate);
$this
->assertFalse(realistic_dummy_content_api_realistic_dummy_content_api_dummy($user, 'user'), 'User with neither an address ending in .invalid nor the devel_generate property set is considered non-dummy');
$node = (object) array();
$node->devel_generate = array();
$this
->assertTrue(realistic_dummy_content_api_realistic_dummy_content_api_dummy($node, 'node'), 'Node with the devel_generate property set to an empty array is considered dummy');
unset($node->devel_generate);
$this
->assertFALSE(realistic_dummy_content_api_realistic_dummy_content_api_dummy($node, 'node'), 'Node with the devel_generate not set is considered non-dummy');
$this
->assertSequential(0, 3, 'a', 0);
$this
->assertSequential(0, 3, 'a', 0);
$this
->assertSequential(0, 3, 'b', 1);
$this
->assertSequential(0, 3, 'b', 1);
$this
->assertSequential(0, 3, 'c', 2);
$this
->assertSequential(0, 3, 'c', 2);
$this
->assertSequential(0, 3, 'd', 3);
$this
->assertSequential(0, 2, 'd', 2);
$this
->assertSequential(10, 13, 'd', 10);
$this
->assertSequential(11, 12, 'd', 11);
}