.../comment/src/Tests/CommentNonNodeTest.php | 22 +++++++++--------- .../src/Tests/ConfigTranslationUiTest.php | 2 +- .../src/Tests/ContentTranslationSyncImageTest.php | 2 +- .../datetime/src/Tests/DateTimeFieldTest.php | 4 ++-- .../src/Tests/EntityReferenceIntegrationTest.php | 2 +- .../field/src/Tests/Boolean/BooleanFieldTest.php | 6 ++--- .../field/src/Tests/Number/NumberFieldTest.php | 2 +- .../field_ui/src/Routing/RouteSubscriber.php | 2 +- .../field_ui/src/Tests/FieldUIRouteTest.php | 2 +- core/modules/system/system.routing.yml | 3 --- .../entity_test/src/Routing/EntityTestRoutes.php | 5 +++-- core/profiles/standard/src/Tests/StandardTest.php | 26 ++++++++++++++++++++++ 12 files changed, 51 insertions(+), 27 deletions(-) diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php index 6321d0d..58191b3 100644 --- a/core/modules/comment/src/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php @@ -258,15 +258,15 @@ function testCommentFunctionality() { )); $this->drupalLogin($limited_user); // Test that default field exists. - $this->drupalGet('admin/structure/entity_test/entity_test/fields'); + $this->drupalGet('entity_test/structure/entity_test/fields'); $this->assertText(t('Comments')); - $this->assertLinkByHref('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.comment'); + $this->assertLinkByHref('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); // Test widget hidden option is not visible when there's no comments. - $this->drupalGet('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.comment'); + $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); $this->assertResponse(200); $this->assertNoField('edit-default-value-input-comment-und-0-status-0'); // Test that field to change cardinality is not available. - $this->drupalGet('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.comment/storage'); + $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment/storage'); $this->assertResponse(200); $this->assertNoField('cardinality_number'); $this->assertNoField('cardinality'); @@ -389,7 +389,7 @@ function testCommentFunctionality() { 'administer entity_test content', )); $this->drupalLogin($limited_user); - $this->drupalGet('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.comment'); + $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); $this->assertNoFieldChecked('edit-default-value-input-comment-0-status-0'); $this->assertNoFieldChecked('edit-default-value-input-comment-0-status-1'); $this->assertFieldChecked('edit-default-value-input-comment-0-status-2'); @@ -399,7 +399,7 @@ function testCommentFunctionality() { 'settings[anonymous]' => COMMENT_ANONYMOUS_MAY_CONTACT, ); $this->drupalPostForm(NULL, $edit, t('Save settings')); - $this->drupalGet('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.comment'); + $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); $this->assertNoFieldChecked('edit-default-value-input-comment-0-status-0'); $this->assertFieldChecked('edit-default-value-input-comment-0-status-1'); $this->assertNoFieldChecked('edit-default-value-input-comment-0-status-2'); @@ -418,11 +418,11 @@ function testCommentFunctionality() { $storage_edit = array( 'settings[comment_type]' => 'foobar', ); - $this->fieldUIAddNewField('admin/structure/entity_test/entity_test', 'foobar', 'Foobar', 'comment', $storage_edit); + $this->fieldUIAddNewField('entity_test/structure/entity_test', 'foobar', 'Foobar', 'comment', $storage_edit); // Add a third comment field. - $this->fieldUIAddNewField('admin/structure/entity_test/entity_test', 'barfoo', 'BarFoo', 'comment', $storage_edit); - + $this->fieldUIAddNewField('entity_test/structure/entity_test', 'barfoo', 'BarFoo', 'comment', $storage_edit); +return; // Check the field contains the correct comment type. $field_storage = FieldStorageConfig::load('entity_test.field_barfoo'); $this->assertTrue($field_storage); @@ -474,7 +474,7 @@ public function testsNonIntegerIdEntities() { )); $this->drupalLogin($limited_user); // Visit the Field UI field add page. - $this->drupalGet('admin/structure/entity_test_string_id/entity_test/fields/add-field'); + $this->drupalGet('entity_test_string_id/structure/entity_test/fields/add-field'); // Ensure field isn't shown for string IDs. $this->assertNoOption('edit-new-storage-type', 'comment'); // Ensure a core field type shown. @@ -486,7 +486,7 @@ public function testsNonIntegerIdEntities() { 'administer entity_test_no_id fields', ))); // Visit the Field UI field add page. - $this->drupalGet('admin/structure/entity_test_no_id/entity_test/fields/add-field'); + $this->drupalGet('entity_test_no_id/structure/entity_test/fields/add-field'); // Ensure field isn't shown for empty IDs. $this->assertNoOption('edit-new-storage-type', 'comment'); // Ensure a core field type shown. diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index ced8948..f220d1a 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@ -747,7 +747,7 @@ public function testFieldConfigTranslation() { $this->drupalLogin($this->translatorUser); - $this->drupalGet("/admin/structure/entity_test/$bundle/fields/entity_test.$bundle.$field_name/translate"); + $this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate"); $this->clickLink('Add'); $this->assertText('Translatable field setting'); diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php index a298c72..606b5b3 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php @@ -87,7 +87,7 @@ protected function getEditorPermissions() { function testImageFieldSync() { // Check that the alt and title fields are enabled for the image field. $this->drupalLogin($this->editor); - $this->drupalGet('admin/structure/entity_test_mul/' . $this->entityTypeId . '/fields/' . $this->entityTypeId . '.' . $this->entityTypeId . '.' . $this->fieldName); + $this->drupalGet('entity_test_mul/structure/' . $this->entityTypeId . '/fields/' . $this->entityTypeId . '.' . $this->entityTypeId . '.' . $this->fieldName); $this->assertFieldChecked('edit-third-party-settings-content-translation-translation-sync-alt'); $this->assertFieldChecked('edit-third-party-settings-content-translation-translation-sync-title'); $edit = array( diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index 5eb9820..d5d14a4 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -408,7 +408,7 @@ function testDatelistWidget() { $this->assertNoFieldByXPath("//*[@id=\"edit-$field_name-0-value-minute\"]", NULL, 'Minute element not found on Date Only.'); // Go to the form display page to assert that increment option does not appear on Date Only - $fieldEditUrl = 'admin/structure/entity_test/entity_test/form-display'; + $fieldEditUrl = 'entity_test/structure/entity_test/form-display'; $this->drupalGet($fieldEditUrl); // Click on the widget settings button to open the widget settings form. @@ -434,7 +434,7 @@ function testDatelistWidget() { \Drupal::entityManager()->clearCachedFieldDefinitions(); // Go to the form display page to assert that increment option does appear on Date Time - $fieldEditUrl = 'admin/structure/entity_test/entity_test/form-display'; + $fieldEditUrl = 'entity_test/structure/entity_test/form-display'; $this->drupalGet($fieldEditUrl); // Click on the widget settings button to open the widget settings form. diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php index 47fae0b..c059848 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php @@ -148,7 +148,7 @@ public function testSupportedEntityTypesAndWidgets() { if ($key == 'content') { $field_edit['settings[handler_settings][target_bundles][' . $referenced_entities[0]->getEntityTypeId() . ']'] = TRUE; } - $this->drupalPostForm('admin/structure/' . $this->entityType . '/' . $this->bundle .'/fields/' . $this->entityType . '.' . $this->bundle . '.' . $this->fieldName, $field_edit, t('Save settings')); + $this->drupalPostForm($this->entityType . '/structure/' . $this->bundle .'/fields/' . $this->entityType . '.' . $this->bundle . '.' . $this->fieldName, $field_edit, t('Save settings')); // Ensure the configuration has the expected dependency on the entity that // is being used a default value. $field = FieldConfig::loadByName($this->entityType, $this->bundle, $this->fieldName); diff --git a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php index 82da958..2364a8a 100644 --- a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php +++ b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php @@ -122,7 +122,7 @@ function testBooleanField() { $edit = array( 'settings[on_label]' => $on, ); - $this->drupalPostForm('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.' . $field_name, $edit, t('Save settings')); + $this->drupalPostForm('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name, $edit, t('Save settings')); // Check if we see the updated labels in the creation form. $this->drupalGet('entity_test/add'); $this->assertRaw($on); @@ -144,7 +144,7 @@ function testBooleanField() { // Go to the form display page and check if the default settings works as // expected. - $fieldEditUrl = 'admin/structure/entity_test/entity_test/form-display'; + $fieldEditUrl = 'entity_test/structure/entity_test/form-display'; $this->drupalGet($fieldEditUrl); // Click on the widget settings button to open the widget settings form. @@ -177,7 +177,7 @@ function testBooleanField() { ); // Test the boolean field settings. - $this->drupalGet('admin/structure/entity_test/entity_test/fields/entity_test.entity_test.' . $field_name); + $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name); $this->assertFieldById('edit-settings-on-label', $on); $this->assertFieldById('edit-settings-off-label', $off); } diff --git a/core/modules/field/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php index a3af520..a3226a9 100644 --- a/core/modules/field/src/Tests/Number/NumberFieldTest.php +++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php @@ -516,7 +516,7 @@ function testCreateNumberDecimalField() { * Helper function to set the minimum value of a field. */ function assertSetMinimumValue($field, $minimum_value) { - $field_configuration_url = 'admin/structure/entity_test/entity_test/fields/entity_test.entity_test.' . $field->getName(); + $field_configuration_url = 'entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field->getName(); // Set the minimum value. $edit = array( diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index f31ff2b..8f1b8f1 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -47,7 +47,7 @@ protected function alterRoutes(RouteCollection $collection) { } $path = $entity_route->getPath(); - $options = array(); + $options = $entity_route->getOptions(); if ($bundle_entity_type = $entity_type->getBundleEntityType()) { $options['parameters'][$bundle_entity_type] = array( 'type' => 'entity:' . $bundle_entity_type, diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php index 8fddfd0..332a87d 100644 --- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php +++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php @@ -38,7 +38,7 @@ protected function setUp() { * Ensures that entity types with bundles do not break following entity types. */ public function testFieldUIRoutes() { - $this->drupalGet('admin/structure/entity_test_no_id/entity_test/fields'); + $this->drupalGet('entity_test_no_id/structure/entity_test/fields'); $this->assertText('No fields are present yet.'); $this->drupalGet('admin/config/people/accounts/fields'); diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 1ab792a..2da5126 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -454,9 +454,6 @@ system.db_update: path: '/update.php/{op}' defaults: op: 'info' - options: - _maintenance_access: TRUE - no_cache: TRUE requirements: _access: 'TRUE' diff --git a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php index 31e0e69..09d677f 100644 --- a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php +++ b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php @@ -58,9 +58,10 @@ public function routes() { ); $routes["entity.$entity_type_id.admin_form"] = new Route( - "admin/structure/$entity_type_id/{bundle}", + "$entity_type_id/structure/{bundle}", array('_controller' => '\Drupal\entity_test\Controller\EntityTestController::testAdmin'), - array('_permission' => 'administer entity_test content') + array('_permission' => 'administer entity_test content'), + array('_admin_route' => TRUE) ); } return $routes; diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index ee867d1..d058027 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -9,6 +9,8 @@ use Drupal\config\Tests\SchemaCheckTestTrait; use Drupal\contact\Entity\ContactForm; +use Drupal\Core\Cache\Cache; +use Drupal\Core\Url; use Drupal\filter\Entity\FilterFormat; use Drupal\simpletest\WebTestBase; use Drupal\user\Entity\Role; @@ -157,6 +159,30 @@ function testStandard() { $this->drupalLogin($this->rootUser); $this->drupalGet('update.php/selection'); $this->assertText('No pending updates.'); + + // Verify certain routes' responses are cacheable by SmartCache, to ensure + // these responses are very fast for authenticated users. + $url = Url::fromRoute('contact.site_page'); + $this->drupalGet($url); + $this->assertEqual('UNCACHEABLE', $this->drupalGetHeader('X-Drupal-SmartCache'), 'Site-wide contact page cannot be cached by SmartCache.'); + $url = Url::fromRoute(''); + $this->drupalGet($url); + $this->drupalGet($url); + $this->assertEqual('HIT', $this->drupalGetHeader('X-Drupal-SmartCache'), 'Frontpage is cached by SmartCache.'); + $url = Url::fromRoute('entity.node.canonical', ['node' => 1]); + $this->drupalGet($url); + $this->drupalGet($url); + $this->assertEqual('HIT', $this->drupalGetHeader('X-Drupal-SmartCache'), 'Full node page is cached by SmartCache.'); + $url = Url::fromRoute('entity.user.canonical', ['user' => 1]); + $this->drupalGet($url); + $this->drupalGet($url); + $this->assertEqual('HIT', $this->drupalGetHeader('X-Drupal-SmartCache'), 'User profile page is cached by SmartCache.'); + $url = Url::fromRoute('system.admin'); + $this->drupalGet($url); + $this->assertFalse($this->drupalGetHeader('X-Drupal-SmartCache'), 'Admin pages cannot be cached by SmartCache.'); + $url = Url::fromRoute('system.db_update'); + $this->drupalGet($url); + $this->assertFalse($this->drupalGetHeader('X-Drupal-SmartCache'), 'update.php page cannot be cached by SmartCache.'); } }