Commit 98be22d2 authored by webchick's avatar webchick

Issue #2568331 by neclimdul: Add orderby to MenuLink sources to avoid stubbing

parent e81caa00
......@@ -25,6 +25,8 @@ class MenuLink extends DrupalSqlBase {
public function query() {
return $this->select('menu_links', 'ml')
->fields('ml')
->orderby('ml.depth')
->orderby('ml.mlid')
->condition('module', 'menu')
->condition('customized', 1);
}
......
......@@ -47,7 +47,7 @@ public function testMenuLinks() {
$this->assertIdentical(FALSE, $menu_link->isExpanded());
$this->assertIdentical(['attributes' => ['title' => 'Test menu link 1']], $menu_link->link->options);
$this->assertIdentical('internal:/user/login', $menu_link->link->uri);
$this->assertIdentical(15, $menu_link->getWeight());
$this->assertIdentical(-50, $menu_link->getWeight());
$menu_link = MenuLinkContent::load(139);
$this->assertIdentical('Test 2', $menu_link->getTitle());
......@@ -57,7 +57,7 @@ public function testMenuLinks() {
$this->assertIdentical(TRUE, $menu_link->isExpanded());
$this->assertIdentical(['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], $menu_link->link->options);
$this->assertIdentical('internal:/admin', $menu_link->link->uri);
$this->assertIdentical(12, $menu_link->getWeight());
$this->assertIdentical(-49, $menu_link->getWeight());
$menu_link = MenuLinkContent::load(140);
$this->assertIdentical('Drupal.org', $menu_link->getTitle());
......@@ -67,7 +67,7 @@ public function testMenuLinks() {
$this->assertIdentical(FALSE, $menu_link->isExpanded());
$this->assertIdentical(['attributes' => ['title' => '']], $menu_link->link->options);
$this->assertIdentical('https://www.drupal.org', $menu_link->link->uri);
$this->assertIdentical(0, $menu_link->getWeight());
$this->assertIdentical(-50, $menu_link->getWeight());
// assert that missing title attributes don't stop or break migration.
$menu_link = MenuLinkContent::load(393);
......@@ -78,7 +78,7 @@ public function testMenuLinks() {
$this->assertIdentical(FALSE, $menu_link->isExpanded());
$this->assertIdentical([], $menu_link->link->options);
$this->assertIdentical('internal:/user/login', $menu_link->link->uri);
$this->assertIdentical(15, $menu_link->getWeight());
$this->assertIdentical(-47, $menu_link->getWeight());
}
}
......@@ -347,7 +347,7 @@ public function load() {
))->values(array(
'menu_name' => 'secondary-links',
'mlid' => '138',
'plid' => '0',
'plid' => '139',
'link_path' => 'user/login',
'router_path' => 'user/login',
'link_title' => 'Test 1',
......@@ -357,11 +357,11 @@ public function load() {
'external' => '0',
'has_children' => '1',
'expanded' => '0',
'weight' => '15',
'depth' => '1',
'weight' => '-50',
'depth' => '2',
'customized' => '1',
'p1' => '138',
'p2' => '0',
'p1' => '139',
'p2' => '138',
'p3' => '0',
'p4' => '0',
'p5' => '0',
......@@ -373,7 +373,7 @@ public function load() {
))->values(array(
'menu_name' => 'secondary-links',
'mlid' => '139',
'plid' => '138',
'plid' => '0',
'link_path' => 'admin',
'router_path' => 'admin',
'link_title' => 'Test 2',
......@@ -381,13 +381,13 @@ public function load() {
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'has_children' => '1',
'expanded' => '1',
'weight' => '12',
'depth' => '2',
'weight' => '-49',
'depth' => '1',
'customized' => '1',
'p1' => '138',
'p2' => '139',
'p1' => '139',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
......@@ -409,10 +409,10 @@ public function load() {
'external' => '1',
'has_children' => '0',
'expanded' => '0',
'weight' => '0',
'weight' => '-50',
'depth' => '1',
'customized' => '1',
'p1' => '0',
'p1' => '140',
'p2' => '0',
'p3' => '0',
'p4' => '0',
......@@ -5167,10 +5167,10 @@ public function load() {
'external' => '0',
'has_children' => '1',
'expanded' => '0',
'weight' => '15',
'weight' => '-47',
'depth' => '1',
'customized' => '1',
'p1' => '138',
'p1' => '393',
'p2' => '0',
'p3' => '0',
'p4' => '0',
......@@ -5262,4 +5262,4 @@ public function load() {
}
}
#ee26910a904b8d0de72248c7b8fec0c9
#6a7e6d4a9548466dfb6d9c5ab659126f
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment