t('[223159] Regression: hook_link() merges rather than overwrites'), 'desc' => t('In 6.x, it causes a WSOD after hanging for a few seconds. :( This is because instead of a strings being passed into url() and check_plain(), they\'re instead arrays, as the link now looks like this.'), 'group' => t('Drupal 7 Tests'), ); } function test_issue() { $node = $this->createPage(); // requested link key $link_name = $this->randomName(); // create module 1 $module_name1 = $this->randomName(); $this->createModule($module_name1, $link_name); $this->drupalModuleEnable($module_name1); // here must be the link from module 1 $this->drupalGet("node/{$node->nid}"); $this->assertWantedRaw("$module_name1 link", 'Check link 1'); // create module 2 with the same requested link $module_name2 = $this->randomName(); $this->createModule($module_name2, $link_name); $this->drupalModuleEnable($module_name2); // here must be the link from module 2 now $this->drupalGet("node/{$node->nid}"); $this->assertWantedRaw("$module_name1 link", 'Check link 1'); $this->assertWantedRaw("$module_name2 link", 'Check link 2'); $this->deleteModule($module_name1); $this->deleteModule($module_name2); } function createPage() { $this->drupalVariableSet('node_options_page', array('status', 'promote')); $web_user = $this->drupalCreateUserRolePerm(array('edit own page content', 'create page content')); $this->drupalLoginUser($web_user); $edit = array(); $edit['title'] = '!SimpleTest test node! ' . $this->randomName(10); $edit['body'] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32); $this->drupalPost('node/add/page', $edit, 'Save'); $this->assertWantedRaw(t('!post %title has been created.', array ('!post' => 'Page', '%title' => $edit['title'])), 'Page created'); $node = node_load(array('title' => $edit['title'])); $this->assertNotNull($node, 'Node found in database. %s'); return $node; } function createModule($module_name, $link_name) { $module_dir = "sites/all/modules/$module_name"; $module_file = "$module_dir/$module_name.module"; $module_file_info = "$module_dir/$module_name.info"; @mkdir($module_dir); $info = << t("$module_name link"), 'href' => "link/to/$module_name", ); return \$links; } } EOF; $fp = fopen($module_file_info, 'w'); if ($fp && fwrite($fp, $info) === FALSE) { echo('error!!!'); /// remove } fclose($fp); $fp = fopen($module_file, 'w'); if ($fp && fwrite($fp, $module) === FALSE) { echo('error!!!'); /// remove } fclose($fp); } function deleteModule($module_name) { $module_dir = "sites/all/modules/$module_name"; $module_file = "$module_dir/$module_name.module"; $module_file_info = "$module_dir/$module_name.info"; @unlink($module_file); @unlink($module_file_info); @rmdir($module_dir); } }