From 8b2a61b313c00cd77c08ba80b91bd367c5163332 Mon Sep 17 00:00:00 2001 From: Brian Canini <canini.16@osu.edu> Date: Thu, 25 Jun 2020 12:39:00 -0400 Subject: [PATCH] Updating drupal/field_permissions (1.0.0-rc2 => 1.0.0) --- composer.json | 2 +- composer.lock | 34 +++++----- vendor/composer/installed.json | 34 +++++----- web/modules/field_permissions/composer.json | 7 +- .../field_permissions.info.yml | 10 +-- .../src/FieldPermissionsServiceInterface.php | 6 +- .../field_permissions_test.info.yml | 8 +-- .../FieldPermissionsCommentTest.php | 65 +++++++++++-------- .../Functional/FieldPermissionsNodeTest.php | 30 ++++----- .../Functional/FieldPermissionsTestBase.php | 5 ++ .../Functional/FieldPermissionsUserTest.php | 32 +++++---- .../tests/src/Functional/FieldReportTest.php | 5 ++ .../FieldPermissionType/ManagerTest.php | 2 +- .../FieldPermissionType/CustomAccessTest.php | 2 +- 14 files changed, 140 insertions(+), 102 deletions(-) diff --git a/composer.json b/composer.json index 9a1fb922e5..5cf7bb8c33 100644 --- a/composer.json +++ b/composer.json @@ -121,7 +121,7 @@ "drupal/externalauth": "1.1", "drupal/features": "3.8", "drupal/field_group": "3.0", - "drupal/field_permissions": "1.0-rc2", + "drupal/field_permissions": "1.0", "drupal/file_browser": "1.1", "drupal/focal_point": "1.4", "drupal/geolocation": "1.10", diff --git a/composer.lock b/composer.lock index 2e1c59c874..0716f46481 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b92b53385fd085532a6ff33f1dc006cb", + "content-hash": "44205f6f0ba7fd5b6962abf56dc6f2b1", "packages": [ { "name": "alchemy/zippy", @@ -4871,44 +4871,48 @@ }, { "name": "drupal/field_permissions", - "version": "1.0.0-rc2", + "version": "1.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/field_permissions.git", - "reference": "8.x-1.0-rc2" + "reference": "8.x-1.0" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.0-rc2.zip", - "reference": "8.x-1.0-rc2", - "shasum": "bbc0d4215b24f2613a02a365a22f2039ebcea421" + "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.0.zip", + "reference": "8.x-1.0", + "shasum": "637895909b2877a69e04f76446addb4abc7492c5" }, "require": { - "drupal/core": "~8.0" + "drupal/core": "^8 || ^9" }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, "drupal": { - "version": "8.x-1.0-rc2", - "datestamp": "1545332280", + "version": "8.x-1.0", + "datestamp": "1591319671", "security-coverage": { - "status": "not-covered", - "message": "RC releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } + }, + "branch-alias": { + "dev-8.x-1.x": "1.x-dev" } }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { "name": "RobLoach", "homepage": "https://www.drupal.org/user/61114" }, + { + "name": "japerry", + "homepage": "https://www.drupal.org/user/45640" + }, { "name": "jhedstrom", "homepage": "https://www.drupal.org/user/208732" diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b65f2ce7a2..7de52c56c3 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -5015,46 +5015,50 @@ }, { "name": "drupal/field_permissions", - "version": "1.0.0-rc2", - "version_normalized": "1.0.0.0-RC2", + "version": "1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/field_permissions.git", - "reference": "8.x-1.0-rc2" + "reference": "8.x-1.0" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.0-rc2.zip", - "reference": "8.x-1.0-rc2", - "shasum": "bbc0d4215b24f2613a02a365a22f2039ebcea421" + "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.0.zip", + "reference": "8.x-1.0", + "shasum": "637895909b2877a69e04f76446addb4abc7492c5" }, "require": { - "drupal/core": "~8.0" + "drupal/core": "^8 || ^9" }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, "drupal": { - "version": "8.x-1.0-rc2", - "datestamp": "1545332280", + "version": "8.x-1.0", + "datestamp": "1591319671", "security-coverage": { - "status": "not-covered", - "message": "RC releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } + }, + "branch-alias": { + "dev-8.x-1.x": "1.x-dev" } }, "installation-source": "dist", "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { "name": "RobLoach", "homepage": "https://www.drupal.org/user/61114" }, + { + "name": "japerry", + "homepage": "https://www.drupal.org/user/45640" + }, { "name": "jhedstrom", "homepage": "https://www.drupal.org/user/208732" diff --git a/web/modules/field_permissions/composer.json b/web/modules/field_permissions/composer.json index eb5a38cffa..b7a9b62116 100644 --- a/web/modules/field_permissions/composer.json +++ b/web/modules/field_permissions/composer.json @@ -6,5 +6,10 @@ "support": { "issues": "https://www.drupal.org/project/issues/field_permissions" }, - "license": "GPL-2.0+" + "license": "GPL-2.0-or-later", + "extra": { + "branch-alias": { + "dev-8.x-1.x": "1.x-dev" + } + } } diff --git a/web/modules/field_permissions/field_permissions.info.yml b/web/modules/field_permissions/field_permissions.info.yml index 21a91b420c..bf3b56ebc5 100644 --- a/web/modules/field_permissions/field_permissions.info.yml +++ b/web/modules/field_permissions/field_permissions.info.yml @@ -3,10 +3,10 @@ type: module description: 'Set field-level permissions to create, update or view fields.' configure: field_permissions.reports package: field -# core: '8.x' - -# Information added by Drupal.org packaging script on 2018-12-20 -version: '8.x-1.0-rc2' core: '8.x' +core_version_requirement: ^8 || ^9 + +# Information added by Drupal.org packaging script on 2020-06-05 +version: '8.x-1.0' project: 'field_permissions' -datestamp: 1545332284 +datestamp: 1591319673 diff --git a/web/modules/field_permissions/src/FieldPermissionsServiceInterface.php b/web/modules/field_permissions/src/FieldPermissionsServiceInterface.php index d6bb265a11..ac2d347aa7 100644 --- a/web/modules/field_permissions/src/FieldPermissionsServiceInterface.php +++ b/web/modules/field_permissions/src/FieldPermissionsServiceInterface.php @@ -29,7 +29,7 @@ interface FieldPermissionsServiceInterface { * difficult to abstract down to the plugin level the way the report * currently works. * - * @deprecated This function will be removed before 8.x-1.0 + * @deprecated This function will be removed before 8.x-2.0 */ public static function getList($field_label = ''); @@ -39,7 +39,7 @@ public static function getList($field_label = ''); * @return array * An array of permission information keyed by role ID. * - * @deprecated This function will be removed before 8.x-1.0 + * @deprecated This function will be removed before 8.x-2.0 */ public function getPermissionsByRole(); @@ -52,7 +52,7 @@ public function getPermissionsByRole(); * An array of all permissions for all fields that implement the custom * permission type. * - * @deprecated This function will be removed before 8.x-1.0 + * @deprecated This function will be removed before 8.x-2.0 */ public function getAllPermissions(); diff --git a/web/modules/field_permissions/tests/modules/field_permissions_test/field_permissions_test.info.yml b/web/modules/field_permissions/tests/modules/field_permissions_test/field_permissions_test.info.yml index 42585e101d..3fb5354e62 100644 --- a/web/modules/field_permissions/tests/modules/field_permissions_test/field_permissions_test.info.yml +++ b/web/modules/field_permissions/tests/modules/field_permissions_test/field_permissions_test.info.yml @@ -2,12 +2,10 @@ name: 'Field permissions test module' type: module description: 'Provides a test field permission plugin type.' package: Testing -# core: '8.x' dependencies: - field_permissions:field_permissions -# Information added by Drupal.org packaging script on 2018-12-20 -version: '8.x-1.0-rc2' -core: '8.x' +# Information added by Drupal.org packaging script on 2020-06-05 +version: '8.x-1.0' project: 'field_permissions' -datestamp: 1545332284 +datestamp: 1591319673 diff --git a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsCommentTest.php b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsCommentTest.php index a09f197a2a..d400780b79 100644 --- a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsCommentTest.php +++ b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsCommentTest.php @@ -24,6 +24,13 @@ class FieldPermissionsCommentTest extends FieldPermissionsTestBase { */ protected $commentSubject; + /** + * The entity display repository. + * + * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface + */ + protected $entityDisplayRepository; + /** * {@inheritdoc} */ @@ -52,6 +59,8 @@ public function setUp() { $this->fieldName = 'comment_body'; $this->commentSubject = 'Test subject comment'; $this->fieldText = 'A comment'; + + $this->entityDisplayRepository = $this->container->get('entity_display.repository'); } /** @@ -113,7 +122,7 @@ protected function addCommentField() { ])->save(); // Entity form displays: assign widget settings for the 'default' form // mode, and hide the field in all other form modes. - entity_get_form_display($entity_type, $bundle, 'default') + $this->entityDisplayRepository->getFormDisplay($entity_type, $bundle, 'default') ->setComponent($field_name, [ 'type' => 'comment_default', 'weight' => 20, @@ -121,7 +130,7 @@ protected function addCommentField() { ->save(); // Entity view displays: assign widget settings for the 'default' view // mode, and hide the field in all other view modes. - entity_get_display($entity_type, $bundle, 'default') + $this->entityDisplayRepository->getViewDisplay($entity_type, $bundle) ->setComponent($field_name, [ 'label' => 'above', 'type' => 'comment_default', @@ -136,13 +145,13 @@ protected function addCommentField() { ]); $field->save(); // Assign widget settings for the 'default' form mode. - entity_get_form_display('comment', $comment_type_id, 'default') + $this->entityDisplayRepository->getFormDisplay('comment', $comment_type_id, 'default') ->setComponent($this->fieldName, [ 'type' => 'text_textarea', ]) ->save(); // Assign display settings for the 'default' view mode. - entity_get_display('comment', $comment_type_id, 'default') + $this->entityDisplayRepository->getViewDisplay('comment', $comment_type_id) ->setComponent($this->fieldName, [ 'label' => 'hidden', 'type' => 'text_default', @@ -189,15 +198,15 @@ protected function checkBaseCommentFieldFunctionality() { $edit[$this->fieldName . '[0][value]'] = $this->fieldText; $this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalGet('node/' . $this->node->id()); - $this->assertEscaped($this->fieldText); - $this->assertEscaped($this->commentSubject); + $this->assertSession()->assertEscaped($this->fieldText); + $this->assertSession()->assertEscaped($this->commentSubject); $this->drupalLogout(); $this->drupalLogin($this->limitedUser); // Test visibility first comment by admin. $this->drupalGet('node/' . $this->node->id()); - $this->assertEscaped($this->fieldText); - $this->assertText($this->commentSubject); + $this->assertSession()->assertEscaped($this->fieldText); + $this->assertSession()->pageTextContains($this->commentSubject); // Add second comment to node. $edit = []; $edit['subject[0][value]'] = 'Limit User comment subject'; @@ -205,8 +214,8 @@ protected function checkBaseCommentFieldFunctionality() { $this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalGet('node/' . $this->node->id()); // Test visibility second comment by limituser.. - $this->assertText('Limit User comment subject'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment subject'); + $this->assertSession()->pageTextContains('Limit User comment body'); $this->drupalLogout(); } @@ -226,20 +235,20 @@ protected function checkPrivateCommentField() { $this->drupalLogin($this->limitedUser); $this->drupalGet('node/' . $this->node->id()); // Test hide body comment post by Adminuser but display subject.. - $this->assertText($this->commentSubject); - $this->assertNoText($this->fieldText); + $this->assertSession()->pageTextContains($this->commentSubject); + $this->assertSession()->pageTextNotContains($this->fieldText); // Test view your comment. - $this->assertText('Limit User comment subject'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment subject'); + $this->assertSession()->pageTextContains('Limit User comment body'); // Test edit your comment. $this->drupalGet('comment/2/edit'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment body'); // Logout and access as anonymous. $this->drupalLogin($this->webUser); $this->drupalGet('comment/2/edit'); // Comment body should be hidden. - $this->assertNoText('Limit User comment body'); + $this->assertSession()->pageTextNotContains('Limit User comment body'); $this->drupalLogout(); } @@ -260,13 +269,13 @@ protected function checkCustomCommentField() { // View your comment but not view field body comment post by admin. $this->drupalGet('node/' . $this->node->id()); // Hide body comment post by Adminuser. - $this->assertNoText($this->fieldText); - $this->assertText($this->commentSubject); - $this->assertText('Limit User comment subject'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextNotContains($this->fieldText); + $this->assertSession()->pageTextContains($this->commentSubject); + $this->assertSession()->pageTextContains('Limit User comment subject'); + $this->assertSession()->pageTextContains('Limit User comment body'); // Edit your comment not accesss to body field. $this->drupalGet('comment/2/edit'); - $this->assertNoText('Limit User comment body'); + $this->assertSession()->pageTextNotContains('Limit User comment body'); $this->drupalLogout(); $this->drupalLogin($this->adminUser); @@ -279,7 +288,7 @@ protected function checkCustomCommentField() { $this->drupalLogin($this->limitedUser); // Test edit your comment edit field body. $this->drupalGet('comment/2/edit'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment body'); $this->drupalLogout(); $this->drupalLogin($this->adminUser); @@ -289,10 +298,10 @@ protected function checkCustomCommentField() { $this->setCommentFieldPermissions(FieldPermissionTypeInterface::ACCESS_CUSTOM, $permission, $path); // view. $this->drupalGet('node/' . $this->node->id()); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment body'); // edit. $this->drupalGet('comment/2/edit'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment body'); $this->drupalLogout(); } @@ -310,18 +319,18 @@ protected function checkPrivateFieldPermission() { // View. $this->drupalGet('node/' . $this->node->id()); - $this->assertNoText('Limit User comment body'); + $this->assertSession()->pageTextNotContains('Limit User comment body'); // Edit. $this->drupalGet('comment/2/edit'); - $this->assertNoText('Limit User comment body'); + $this->assertSession()->pageTextNotContains('Limit User comment body'); // Add permission access user private field. $this->webUserRole->grantPermission('access private fields')->save(); // View. $this->drupalGet('node/' . $this->node->id()); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment body'); // Edit. $this->drupalGet('comment/2/edit'); - $this->assertText('Limit User comment body'); + $this->assertSession()->pageTextContains('Limit User comment body'); $this->drupalLogout(); } diff --git a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsNodeTest.php b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsNodeTest.php index aa2b6416ac..e56b9483a5 100644 --- a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsNodeTest.php +++ b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsNodeTest.php @@ -74,7 +74,7 @@ protected function addNode() { $this->node = $this->drupalCreateNode(['type' => 'article', 'uid' => $this->limitedUser->id()]); $this->drupalGet('node/' . $this->node->id()); $node_body = $this->node->getFields()['body']->getValue(); - $this->assertText($node_body[0]['value']); + $this->assertSession()->responseContains($node_body[0]['value']); } /** @@ -82,13 +82,13 @@ protected function addNode() { */ protected function addNodeUi() { $this->drupalGet('node/add/article'); - $this->assertText('Body'); + $this->assertSession()->pageTextContains('Body'); $edit = []; $node_name = $this->randomMachineName(); $edit['body[0][value]'] = $this->randomString(); $edit['title[0][value]'] = $node_name; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('Article @name has been created.', ['@name' => $node_name])); + $this->assertSession()->pageTextContains(t('Article @name has been created.', ['@name' => $node_name])); } /** @@ -97,7 +97,7 @@ protected function addNodeUi() { protected function assertNodeFieldVisible() { $field_value = $this->node->getFields()['body']->getValue(); $this->drupalGet('node/' . $this->node->id()); - $this->assertText($field_value[0]['value']); + $this->assertSession()->pageTextContains($field_value[0]['value']); } /** @@ -107,7 +107,7 @@ protected function assertNodeFieldHidden() { $field_value = $this->node->getFields()['body']->getValue(); $this->drupalGet('node/' . $this->node->id()); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText($field_value[0]['value']); + $this->assertSession()->pageTextNotContains($field_value[0]['value']); } /** @@ -115,8 +115,8 @@ protected function assertNodeFieldHidden() { */ protected function assertNodeFieldEditAccess() { $this->drupalGet('node/' . $this->node->id() . '/edit'); - $this->assertText('Title'); - $this->assertText('Body'); + $this->assertSession()->pageTextContains('Title'); + $this->assertSession()->pageTextContains('Body'); } /** @@ -124,9 +124,9 @@ protected function assertNodeFieldEditAccess() { */ protected function assertNodeFieldEditNoAccess() { $this->drupalGet('node/' . $this->node->id() . '/edit'); - $this->assertResponse(200); - $this->assertText('Title'); - $this->assertNoText('Body'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextContains('Title'); + $this->assertSession()->pageTextNotContains('Body'); } /** @@ -136,12 +136,12 @@ protected function checkFieldPermissionConfigurationEdit() { $this->drupalLogin($this->webUser); // Test page without admin field permission. $this->drupalGet('admin/structure/types/manage/article/fields/node.article.body'); - $this->assertResponse(200); - $this->assertNoText('Field visibility and permissions'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextNotContains('Field visibility and permissions'); $this->webUserRole->grantPermission('administer field permissions')->save(); // Test page with admin field permission. $this->drupalGet('admin/structure/types/manage/article/fields/node.article.body'); - $this->assertText('Field visibility and permissions'); + $this->assertSession()->pageTextContains('Field visibility and permissions'); $this->drupalLogout(); } @@ -151,8 +151,8 @@ protected function checkFieldPermissionConfigurationEdit() { protected function checkPermissionPage() { $this->drupalLogin($this->adminUser); $this->drupalGet(Url::fromRoute('user.admin_permissions')); - $this->assertText('Access other users private fields'); - $this->assertText('Administer field permissions'); + $this->assertSession()->pageTextContains('Access other users private fields'); + $this->assertSession()->pageTextContains('Administer field permissions'); $this->drupalLogout(); } diff --git a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsTestBase.php b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsTestBase.php index e4a3ddf523..1e185430d0 100644 --- a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsTestBase.php +++ b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsTestBase.php @@ -84,6 +84,11 @@ abstract class FieldPermissionsTestBase extends BrowserTestBase { 'field_permissions', ]; + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + /** * {@inheritdoc} */ diff --git a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsUserTest.php b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsUserTest.php index 47b94a6b49..c866e6d83a 100644 --- a/web/modules/field_permissions/tests/src/Functional/FieldPermissionsUserTest.php +++ b/web/modules/field_permissions/tests/src/Functional/FieldPermissionsUserTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\field_permissions\Functional; -use Drupal\Component\Utility\Unicode; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\field_permissions\Plugin\FieldPermissionTypeInterface; @@ -15,12 +14,19 @@ */ class FieldPermissionsUserTest extends FieldPermissionsTestBase { + /** + * The entity display repository. + * + * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface + */ + protected $entityDisplayRepository; + /** * {@inheritdoc} */ public function setUp() { parent::setUp(); - $this->fieldName = Unicode::strtolower($this->randomMachineName()); + $this->fieldName = mb_strtolower($this->randomMachineName()); // Remove the '@' symbol so it isn't converted to an email link. $this->fieldText = str_replace('@', '', $this->randomString(42)); @@ -30,6 +36,8 @@ public function setUp() { ->grantPermission('administer users') ->save(); + $this->entityDisplayRepository = $this->container->get('entity_display.repository'); + $this->addUserField(); } @@ -73,15 +81,15 @@ protected function addUserField() { 'bundle' => 'user', ])->save(); - entity_get_form_display('user', 'user', 'default') + $this->entityDisplayRepository->getFormDisplay('user', 'user', 'default') ->setComponent($this->fieldName) ->save(); - entity_get_form_display('user', 'user', 'register') + $this->entityDisplayRepository->getFormDisplay('user', 'user', 'register') ->setComponent($this->fieldName) ->save(); - entity_get_display('user', 'user', 'default') + $this->entityDisplayRepository->getViewDisplay('user', 'user') ->setComponent($this->fieldName) ->save(); } @@ -94,12 +102,12 @@ protected function addUserField() { */ protected function checkUserFieldEdit(UserInterface $account) { $this->drupalGet($account->toUrl('edit-form')); - $this->assertText('Textfield'); + $this->assertSession()->pageTextContains('Textfield'); $edit = []; $edit[$this->fieldName . '[0][value]'] = $this->fieldText; $this->drupalPostForm(NULL, $edit, t('Save')); $this->drupalGet($account->toUrl()); - $this->assertEscaped($this->fieldText); + $this->assertSession()->assertEscaped($this->fieldText); } /** @@ -110,7 +118,7 @@ protected function checkUserFieldEdit(UserInterface $account) { */ protected function assertUserFieldAccess(UserInterface $account) { $this->drupalGet($account->toUrl()); - $this->assertText('Textfield'); + $this->assertSession()->pageTextContains('Textfield'); } /** @@ -122,7 +130,7 @@ protected function assertUserFieldAccess(UserInterface $account) { protected function assertUserFieldNoAccess(UserInterface $account) { $this->drupalGet($account->toUrl()); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText('Textfield'); + $this->assertSession()->pageTextNotContains('Textfield'); } /** @@ -133,7 +141,7 @@ protected function assertUserFieldNoAccess(UserInterface $account) { */ protected function assertUserEditFieldAccess(UserInterface $account) { $this->drupalGet($account->toUrl('edit-form')); - $this->assertText('Textfield'); + $this->assertSession()->pageTextContains('Textfield'); } /** @@ -144,8 +152,8 @@ protected function assertUserEditFieldAccess(UserInterface $account) { */ protected function assertUserEditFieldNoAccess(UserInterface $account) { $this->drupalGet($account->toUrl('edit-form')); - $this->assertResponse(200); - $this->assertNoText('Textfield'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextNotContains('Textfield'); } /** diff --git a/web/modules/field_permissions/tests/src/Functional/FieldReportTest.php b/web/modules/field_permissions/tests/src/Functional/FieldReportTest.php index 5b4a885525..75517eefda 100644 --- a/web/modules/field_permissions/tests/src/Functional/FieldReportTest.php +++ b/web/modules/field_permissions/tests/src/Functional/FieldReportTest.php @@ -26,6 +26,11 @@ class FieldReportTest extends BrowserTestBase { 'text', ]; + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + /** * Field storage. * diff --git a/web/modules/field_permissions/tests/src/Kernel/Plugin/FieldPermissionType/ManagerTest.php b/web/modules/field_permissions/tests/src/Kernel/Plugin/FieldPermissionType/ManagerTest.php index 1894b234c5..1e7315b759 100644 --- a/web/modules/field_permissions/tests/src/Kernel/Plugin/FieldPermissionType/ManagerTest.php +++ b/web/modules/field_permissions/tests/src/Kernel/Plugin/FieldPermissionType/ManagerTest.php @@ -5,7 +5,7 @@ use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldStorageConfig; use Drupal\KernelTests\KernelTestBase; -use Drupal\simpletest\UserCreationTrait; +use Drupal\Tests\user\Traits\UserCreationTrait; /** * Integration tests for the field permission type plugin manager. diff --git a/web/modules/field_permissions/tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php b/web/modules/field_permissions/tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php index ee4feeafbf..41b41e7ed2 100644 --- a/web/modules/field_permissions/tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php +++ b/web/modules/field_permissions/tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php @@ -58,7 +58,7 @@ public function testInvalidOperation() { // Edit|view access allowed. $account = $this->prophesize(AccountInterface::class); $entity = $this->prophesize(EntityInterface::class); - $this->setExpectedException(\AssertionError::class, 'The operation is either "edit" or "view", "bad operation" given instead.'); + $this->expectException(\AssertionError::class, 'The operation is either "edit" or "view", "bad operation" given instead.'); $this->plugin->hasFieldAccess('bad operation', $entity->reveal(), $account->reveal()); } -- GitLab