1 node.test | protected NodePageCacheTest::testNodeSaveAfterUsernameChange() |
Check that cached node info does not run out of sync with user data.
File
- core/
modules/ node/ tests/ node.test, line 3859 - Tests for node.module.
Class
- NodePageCacheTest
- Tests the cache invalidation of node operations.
Code
protected function testNodeSaveAfterUsernameChange() {
$author = $this->backdropCreateUser(array('create page content'));
$node = $this->backdropCreateNode(array(
'uid' => $author->uid,
'name' => $author->name,
));
// Trigger entity cache.
$this->backdropGet('node/' . $node->nid);
// Simulate a username change (without actual form interaction).
$author->name = 'new_name';
user_save($author);
// Freshly load data and compare.
$user = entity_load('user', $author->uid);
$node_after = entity_load('node', $node->nid);
$this->assertEqual($user->name, $node_after->name, 'Name property in loaded node is equal to username after change');
}