updated core
This commit is contained in:
@@ -8,8 +8,8 @@ configure: entity.menu.collection
|
||||
dependencies:
|
||||
- menu_link_content
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1509719929
|
||||
datestamp: 1515021228
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\menu_ui\Tests;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
use Drupal\system\Tests\Cache\PageCacheTagsTestBase;
|
||||
use Drupal\system\Entity\Menu;
|
||||
|
||||
/**
|
||||
* Tests the Menu and Menu Link entities' cache tags.
|
||||
*
|
||||
* @group menu_ui
|
||||
*/
|
||||
class MenuCacheTagsTest extends PageCacheTagsTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('menu_ui', 'block', 'test_page_test');
|
||||
|
||||
/**
|
||||
* Tests cache tags presence and invalidation of the Menu entity.
|
||||
*
|
||||
* Tests the following cache tags:
|
||||
* - "menu:<menu ID>"
|
||||
*/
|
||||
public function testMenuBlock() {
|
||||
$url = Url::fromRoute('test_page_test.test_page');
|
||||
|
||||
// Create a Llama menu, add a link to it and place the corresponding block.
|
||||
$menu = Menu::create(array(
|
||||
'id' => 'llama',
|
||||
'label' => 'Llama',
|
||||
'description' => 'Description text',
|
||||
));
|
||||
$menu->save();
|
||||
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
|
||||
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
|
||||
// Move a link into the new menu.
|
||||
$menu_link = $menu_link_manager->updateDefinition('test_page_test.test_page', array('menu_name' => 'llama', 'parent' => ''));
|
||||
$block = $this->drupalPlaceBlock('system_menu_block:llama', array('label' => 'Llama', 'provider' => 'system', 'region' => 'footer'));
|
||||
|
||||
// Prime the page cache.
|
||||
$this->verifyPageCache($url, 'MISS');
|
||||
|
||||
// Verify a cache hit, but also the presence of the correct cache tags.
|
||||
$expected_tags = array(
|
||||
'rendered',
|
||||
'block_view',
|
||||
'config:block_list',
|
||||
'config:block.block.' . $block->id(),
|
||||
'config:system.menu.llama',
|
||||
// The cache contexts associated with the (in)accessible menu links are
|
||||
// bubbled.
|
||||
'config:user.role.anonymous',
|
||||
);
|
||||
$this->verifyPageCache($url, 'HIT', $expected_tags);
|
||||
|
||||
// Verify that after modifying the menu, there is a cache miss.
|
||||
$this->pass('Test modification of menu.', 'Debug');
|
||||
$menu->set('label', 'Awesome llama');
|
||||
$menu->save();
|
||||
$this->verifyPageCache($url, 'MISS');
|
||||
|
||||
// Verify a cache hit.
|
||||
$this->verifyPageCache($url, 'HIT');
|
||||
|
||||
// Verify that after modifying the menu link weight, there is a cache miss.
|
||||
$menu_link_manager->updateDefinition('test_page_test.test_page', array('weight' => -10));
|
||||
$this->pass('Test modification of menu link.', 'Debug');
|
||||
$this->verifyPageCache($url, 'MISS');
|
||||
|
||||
// Verify a cache hit.
|
||||
$this->verifyPageCache($url, 'HIT');
|
||||
|
||||
// Verify that after adding a menu link, there is a cache miss.
|
||||
$this->pass('Test addition of menu link.', 'Debug');
|
||||
$menu_link_2 = MenuLinkContent::create(array(
|
||||
'id' => '',
|
||||
'parent' => '',
|
||||
'title' => 'Alpaca',
|
||||
'menu_name' => 'llama',
|
||||
'link' => [[
|
||||
'uri' => 'internal:/',
|
||||
]],
|
||||
'bundle' => 'menu_name',
|
||||
));
|
||||
$menu_link_2->save();
|
||||
$this->verifyPageCache($url, 'MISS');
|
||||
|
||||
// Verify a cache hit.
|
||||
$this->verifyPageCache($url, 'HIT');
|
||||
|
||||
// Verify that after resetting the first menu link, there is a cache miss.
|
||||
$this->pass('Test reset of menu link.', 'Debug');
|
||||
$this->assertTrue($menu_link->isResettable(), 'First link can be reset');
|
||||
$menu_link = $menu_link_manager->resetLink($menu_link->getPluginId());
|
||||
$this->verifyPageCache($url, 'MISS');
|
||||
|
||||
// Verify a cache hit.
|
||||
$this->verifyPageCache($url, 'HIT', $expected_tags);
|
||||
|
||||
// Verify that after deleting the menu, there is a cache miss.
|
||||
$this->pass('Test deletion of menu.', 'Debug');
|
||||
$menu->delete();
|
||||
$this->verifyPageCache($url, 'MISS');
|
||||
|
||||
// Verify a cache hit.
|
||||
$this->verifyPageCache($url, 'HIT', ['config:block_list', 'config:user.role.anonymous', 'rendered']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\menu_ui\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Reorder menu items.
|
||||
*
|
||||
* @group menu_ui
|
||||
*/
|
||||
class MenuLinkReorderTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* An administrator user.
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $administrator;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('menu_ui', 'test_page_test', 'node', 'block');
|
||||
|
||||
/**
|
||||
* Test creating, editing, deleting menu links via node form widget.
|
||||
*/
|
||||
function testDefaultMenuLinkReorder() {
|
||||
|
||||
// Add the main menu block.
|
||||
$this->drupalPlaceBlock('system_menu_block:main');
|
||||
|
||||
// Assert that the Home link is available.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink('Home');
|
||||
|
||||
// The administrator user that can re-order menu links.
|
||||
$this->administrator = $this->drupalCreateUser(array(
|
||||
'administer site configuration',
|
||||
'access administration pages',
|
||||
'administer menu',
|
||||
));
|
||||
$this->drupalLogin($this->administrator);
|
||||
|
||||
// Change the weight of the link to a non default value.
|
||||
$edit = array(
|
||||
'links[menu_plugin_id:test_page_test.front_page][weight]' => -10,
|
||||
);
|
||||
$this->drupalPostForm('admin/structure/menu/manage/main', $edit, t('Save'));
|
||||
|
||||
// The link is still there.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink('Home');
|
||||
|
||||
// Clear all caches.
|
||||
$this->drupalPostForm('admin/config/development/performance', [], t('Clear all caches'));
|
||||
|
||||
// Clearing all caches should not affect the state of the menu link.
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertLink('Home');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\menu_ui\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\system\Entity\Menu;
|
||||
|
||||
/**
|
||||
* Tests that uninstalling menu does not remove custom menus.
|
||||
*
|
||||
* @group menu_ui
|
||||
*/
|
||||
class MenuUninstallTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('menu_ui');
|
||||
|
||||
/**
|
||||
* Tests Menu uninstall.
|
||||
*/
|
||||
public function testMenuUninstall() {
|
||||
\Drupal::service('module_installer')->uninstall(array('menu_ui'));
|
||||
|
||||
\Drupal::entityManager()->getStorage('menu')->resetCache(array('admin'));
|
||||
|
||||
$this->assertTrue(Menu::load('admin'), 'The \'admin\' menu still exists after uninstalling Menu UI module.');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\menu_ui\Kernel\Migrate;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of menu_ui settings.
|
||||
*
|
||||
* @group menu_ui
|
||||
*/
|
||||
class MigrateMenuSettingsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = ['menu_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['menu_ui']);
|
||||
$this->executeMigration('menu_settings');
|
||||
}
|
||||
|
||||
public function testMigration() {
|
||||
$this->assertTrue(\Drupal::config('menu_ui.settings')->get('override_parent_selector'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user