public function RealisticDummyContentDatabaseTestCase::testUser in Realistic Dummy Content 7.2
Same name and namespace in other branches
- 8.2 api/drupal7-simpletests/RealisticDummyContentDatabaseTestCase.test \RealisticDummyContentDatabaseTestCase::testUser()
File
- api/
drupal7-simpletests/ RealisticDummyContentDatabaseTestCase.test, line 163 - Drupal 7 tests.
Class
- RealisticDummyContentDatabaseTestCase
- The test case
Code
public function testUser() {
// Create a user with devel_generate
module_load_include('inc', 'devel_generate');
devel_create_users(1, 0);
// Load the user and view
$user = user_load(2);
$filename = $user->picture->filename;
$this
->assertTrue(drupal_substr($filename, 0, drupal_strlen('dummyfile')) == 'dummyfile', 'The user\'s picture file was replaced as expected. We know this because the filename starts with the string "dummyfile"');
$current_picture = $user->picture;
user_save($user);
$user = user_load($user->uid);
$this
->assertTrue($current_picture == $user->picture, 'The dummy file generation happens when the user is first created, not when it is resaved.');
}