instead of using :
$items['admin/structure/menu_manager/%menu/%']
We are going to work with tsid...

We will implement this with a foreach loop.

Comments

iSoLate’s picture

pfrenssen’s picture

iSoLate’s picture

Assigned: iSoLate » Unassigned
Status: Active » Needs review
Cyberwolf’s picture

Assigned: Unassigned » Cyberwolf

I'll start reviewing this.

Cyberwolf’s picture

admin/structure/menu_manager still shows all menus, I think it should only display the menu's which have a translation set.

$menu = db_select('menu_custom', 'cm')
    ->fields('cm')
    ->condition('i18n_tsid', $tsid, '=')
    ->condition('language', $language_content->language)
    ->execute()
    ->fetch(PDO::FETCH_ASSOC);

Inside paddle_menu_manager_menu_overview_form() I'd rather use the i18n translation API methods, like i18n_translation_set_load()) instead of using straight queries on the database.

$this->drupalGet('admin/structure/menu_manager/' . check_plain($menu['i18n_tsid']));

The tsid is always numeric AFAIK, thus it shouldn't be escaped with check_plain().

Cyberwolf’s picture

Assigned: Cyberwolf » Unassigned
Status: Needs review » Needs work
iSoLate’s picture

Assigned: Unassigned » iSoLate
iSoLate’s picture

Assigned: iSoLate » Unassigned
Status: Needs work » Needs review

Fixed!

pfrenssen’s picture

Assigned: Unassigned » pfrenssen

Assigning for review.

pfrenssen’s picture

Status: Needs review » Needs work

The code looks very good, but I have some small remarks about the tests:

Duplicated code

3 of the tests in PaddleMenuManagerUITest start by creating one or more menus. This can be moved to the setUp() method.

Missing documentation

There is a call to menu_rebuild() in PaddleMenuManagerUITest::testMenuOverview(). This is needed because we are creating menus directly through the API rather than using the menu creation forms. It is rather scary to see this in a test though, so some documentation would be nice.

pfrenssen’s picture

Assigned: pfrenssen » Unassigned
Status: Needs work » Needs review

Addressed the issues from #10, and did some more refactoring and cleanup.

0987992 Added documentation.
0af8991 Refactored PaddleMenuManagerUITest: Store translation set ids in a protected variable.
97d1065 Refactored PaddleMenuManagerUITest: Store menus in a protected variable.
5cf6d60 Refactored PaddleMenuManagerUITest: Store language codes in a protected variable.
bc0c92a Inline array declarations are super clean.
pfrenssen’s picture

One more small change: use one of the menus created in the setUp() method in testMenuOverviewTypes():

b505050 Reuse one of the menus created in the test setUp().

iSoLate’s picture

Status: Needs review » Fixed

Reviewed pfrenssen his last commits. Looks good!
Merged! ;)

Status: Fixed » Closed (fixed)

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