TestingParty08: menu_rebuild_needed

catch - August 10, 2008 - 16:04
Project:Drupal
Version:7.x-dev
Component:tests
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Need to test menu rebuilding through the variable 'menu_rebuild_needed'.

#1

nielsvm - October 9, 2008 - 15:34
Status:active» needs review

Harold (MadHarold) and I wrote a simple test for this which should do the job. The test tests if the rebuild is fired by manually deleting a record from menu_router and checking if it returns after a page request.

See patch attached.

AttachmentSize
menu_rebuild_needed_test.patch 2.05 KB
Testbed results
menu_rebuild_needed_test.patchfailedFailed: Failed to install HEAD. a href=http://testing.drupal.org/pifr/file/1/menu_rebuild_needed_test.patchDetailed results/a

#2

mikey_p - October 12, 2008 - 01:44

All tests pass.

#3

mikey_p - October 12, 2008 - 02:08

Change description of final assertion, change delete query to use DBTNG.

AttachmentSize
menu_rebuild_3.patch 2.4 KB
Testbed results
menu_rebuild_3.patchfailedFailed: Failed to install HEAD. a href=http://testing.drupal.org/pifr/file/1/menu_rebuild_3.patchDetailed results/a

#4

benshell - October 12, 2008 - 02:35
Status:needs review» reviewed & tested by the community

It works and the code makes sense.

#5

webchick - October 12, 2008 - 03:27
Status:reviewed & tested by the community» needs work

Ok, since this is a TestingParty patch, that means a merciless review since that way you learn best practices. Also, it's fun. ;)

<?php
+class MenuRebuildCase extends DrupalWebTestCase {
?>

a) That should be MenuRebuildTestCase.
b) Please include a one-liner of PHPDoc to explain what this test case is for.

<?php
/**
+   * Test if the 'menu_rebuild_needed' variable triggers
+   * an menu_rebuild() call.
+   */
?>

a) PHPDoc above functions should always attempt to fit in one line at < 80 chars. If more explanation than that is needed, make it a second sentence below.
b) Should be a menu_rebuild() not an menu_rebuild().

<?php
+    // Check if 'admin' exists
?>

All comments should end in a period.

<?php
+    $adminexists = db_result(db_query("SELECT path from {menu_router} WHERE path='admin'"));
?>

a) We don't smoosh together words, so this should be $admin_exists. Needs changing throughout.

<?php
+    $this->drupalGet('<front>');// menu_execute_active_handler() should trigger the rebuild.
?>

Please move this to up above this line instead. Inline inline comments are ok for rare circumstances but are generally discouraged, especially when they're long like this.

Darn! That's all I could find. Great job! :)

#6

mikey_p - October 12, 2008 - 20:56
Status:needs work» needs review

Fun huh? I can't imagine what you qualify as 'unfun,' but anyway....

Fixed all your points.

AttachmentSize
menu_rebuild_6.patch 2.26 KB
Testbed results
menu_rebuild_6.patchre-testing

#7

nielsvm - October 26, 2008 - 18:12

Updated patch to remove the always surprising trailing whitespace.

AttachmentSize
menu_rebuild_7.patch 1.96 KB
Testbed results
menu_rebuild_7.patchre-testing

#8

System Message - November 16, 2008 - 21:50
Status:needs review» needs work

The last submitted patch failed testing.

#9

lilou - November 17, 2008 - 14:16

#10

catch - November 19, 2008 - 01:17
Status:needs review» needs work

We no longer have phpdoc for setUp(), getInfo() or tearDown()
http://drupal.org/node/325974

#11

mikey_p - November 19, 2008 - 01:58
Status:needs work» needs review

Something to be thankful for, at a thankful time of year ;)

Cleans up all of modules/simpletest/tests/menu.test.

AttachmentSize
menu_rebuild_8.patch 2.65 KB
Testbed results
menu_rebuild_8.patchpassedPassed: 7300 passes, 0 fails, 0 exceptions Detailed results

#12

catch - November 19, 2008 - 10:45
Status:needs review» reviewed & tested by the community

Patch looks good, all tests pass. RTBC.

#13

webchick - November 20, 2008 - 07:19
Status:reviewed & tested by the community» fixed

Committed to HEAD with some minor whitespace clean-up. Thanks!! :)

#14

System Message - December 4, 2008 - 07:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.