You are here

function SpacesMenuTestCase::testMenuOrdering in Spaces 7

Same name and namespace in other branches
  1. 6.3 tests/spaces.test \SpacesMenuTestCase::testMenuOrdering()
  2. 7.3 tests/spaces.test \SpacesMenuTestCase::testMenuOrdering()

File

tests/spaces.test, line 354

Class

SpacesMenuTestCase
Test for menu re-ordering

Code

function testMenuOrdering() {

  // Select the Navigation block to be configured and moved.
  $block = array();
  $block['module'] = 'spaces';
  $block['delta'] = 'menu_editor';

  // Set the created block to a specific region.
  $edit = array();
  $edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = 'sidebar_first';
  $this
    ->drupalPost('admin/structure/block', $edit, t('Save blocks'));

  // Confirm that the block was moved to the proper region.
  $this
    ->assertText(t('The block settings have been updated.'), t('Block successfully moved to left region.'));
  $this
    ->assertText(t('Reorder menu'), t('Block successfully being displayed on the page.'));

  // Set the navigation menu as primary
  $edit = array();
  $edit['menu_main_links_source'] = 'navigation';
  $this
    ->drupalPost('admin/structure/menu/settings', $edit, t('Save configuration'));

  // Get link order
  $links = $this
    ->getMenuOrder();

  // Reverse link order
  $edit = array(
    'space_menu_items' => json_encode(array_reverse($links)),
  );
  $this
    ->drupalPost('node', $edit, t('Save'));
  $this
    ->assertText(t('The configuration options have been saved.'), t('Menu order successfully saved.'));
  $changed = $this
    ->getMenuOrder();
  $this
    ->assert($changed == array_reverse($links), t('Menu changes successfully displayed'));
}