Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weight option #209

Closed
wants to merge 3 commits into from
Closed

Conversation

folliked
Copy link

Usage:

<?php

$factory = new MenuFactory();

$menu = $factory->createItem('My menu');
$menu->addChild('Home', array('uri' => '/', 'weight' => 10));
$menu->addChild('Comments', array('uri' => '#comments'));
$menu->addChild('Symfony2', array('uri' => 'http://symfony-reloaded.org/'));
$menu->addChild('Coming soon', array('weight' => 20));

$renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher());
echo $renderer->render($menu);

Final sort will be: Coming soon, Home, Comments, Symfony2, (as the default weight is 0)

@@ -19,15 +19,7 @@ public function testIterator()

public function testRecursiveIterator()
{
// Adding an item which does not provide a RecursiveIterator to be sure it works properly.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are killing the purpose of the test here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the sort on addChild, this test become impossible because prophecy use exceptions and php don't support it while sorting (it throw a warning and make tests fail).

https://bugs.php.net/bug.php?id=50688

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the test is now useless. So this is the wrong way to fix the test.

@dbu
Copy link
Collaborator

dbu commented Aug 26, 2015

are #207 and this one different attempts to solve the same issue?

@garak
Copy link
Collaborator

garak commented Aug 1, 2019

I guess we can close this for the same reason we closed #207

@garak garak closed this Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants