The realname static cache retains old data after user updated, for example:
realname_pattern = '[user:name-raw]'
$user1 = user_load($uid);
$realname1 = $user1->realname;
// Update user name.
$user1->name = 'bar';
user_save($user1);
// Reload the user.
$user2 = user_load($uid);
$realname2 = $user2->realname;
or
$wrapper1 = entity_metadata_wrapper('user', $uid);
$realname1 = $wrapper1->label();
// Update user name.
$wrapper1->name = $this->randomName();
$wrapper1->save();
// Reload the user.
$wrapper2 = entity_metadata_wrapper('user', $uid);
$realname2 = $wrapper2->label();
result: $realname1 == $realname2
expect: $realname1 != $realname2
Comments
Comment #2
edaa commentedComment #8
edaa commentedExtra field test failed on 7.x-1.x, change the version to 7.x-1.2
Comment #9
edaa commentedComment #15
hass commentedPatches are always applied against dev.
Comment #16
hass commentedFixed the failing tests.
Please write a test for this bug!
Comment #18
edaa commentedAdded test for user update hook
Comment #19
edaa commentedComment #20
edaa commentedAdd more test for user update via entity_metadata_wrapper.
Comment #25
edaa commentedComment #30
edaa commentedAdd entity test dependency.
Comment #36
edaa commentedClean up the test, now it should work.
Comment #41
edaa commentedThe test is passed locally, seems that testbot is failed to enable entity module, remove the entity test dependency.
Comment #42
hass commentedYou also need to add entity as dependency to the test. See this example:
Comment #43
edaa commentedThanks! now it's a full patch including test for the entity metadata wrapper.
Comment #48
edaa commentedComment #53
edaa commentedComment #58
edaa commentedtestbot seems not hpaay, re-add same patch.
Comment #63
edaa commentedComment #68
hass commentedTry adding the test_dependency, too.
Comment #69
edaa commentedComment #74
edaa commentedthanks, add
test_dependencies[] = entityComment #79
edaa commenteddrupalci.org error:
However testbot does not recognize
test_dependencies[] = entityand the entity module not downloaded.Comment #80
edaa commentedas per #1670936-2: Testbot does not detect/download additional dependencies:
Added a new realname_entity.test for user update test via entity_metadata_wrapper.
Comment #81
hass commentedThe very last idea I have is that someone may have a duplicate module on d.o and the tedtbot is confused. Try test_dependency with "entity:entity". If it still fails we need to open a case with testbot team.
Comment #82
edaa commentedAre you meaning add
test_dependencies = entity:entityto realname.info?Comment #83
edaa commentedAdded
test_dependencies = entity:entityto realname.infoComment #88
edaa commentedI think the patch on #80 is acceptable, @hass, how do you think?
Comment #89
hass commentedYes, I think we can go with this. Can you upgrade the test to D8, please?
Comment #90
hass commentedComment #95
hass commentedWhy is the entity tests not failing?
Comment #98
hass commentedCommitted the basic patch to D8, too. I guess the entity patch may be obsolete or it need to be rewritten. Just a guess. If you know how, please try it. D8 branch is not clean, so all fails nevertheless until now.
Comment #101
edaa commentedYes, the entity test patch is ignored, since there is a
dependencies => array('entity')in getInfo() method.A test class is skipped if it requires a non-existing module,
see simpletest.module#374.
Comment #102
edaa commentedSorry hass, I am not familiar with D8.