Commit c1328dfa authored by catch's avatar catch
Browse files

fix: #3557391 Fix deprecations in...

fix: #3557391 Fix deprecations in \Drupal\Core\Entity\EntityAccessControlHandler caused by kernel tests

By: @alexpott
(cherry picked from commit 55174bf9)
parent e4ad6a68
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

namespace Drupal\Tests\node\Kernel;

use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\KernelTests\KernelTestBase;
use Drupal\node\NodeInterface;
@@ -109,13 +110,13 @@ public function assertNodeAccess(array $ops, NodeInterface $node, AccountInterfa
   *   Whether access should be granted or not.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user account for which to check access.
   * @param string|null $langcode
   * @param string $langcode
   *   (optional) The language code indicating which translation of the node
   *   to check. If NULL, the untranslated (fallback) access is checked.
   *   to check. If omitted, the untranslated (fallback) access is checked.
   *
   * @internal
   */
  public function assertNodeCreateAccess(string $bundle, bool $result, AccountInterface $account, ?string $langcode = NULL) {
  public function assertNodeCreateAccess(string $bundle, bool $result, AccountInterface $account, string $langcode = LanguageInterface::LANGCODE_DEFAULT) {
    $this->assertEquals($result, $this->accessHandler->createAccess($bundle, $account, [
      'langcode' => $langcode,
    ]), $this->nodeAccessAssertMessage('create', $result, $langcode));
+4 −2
Original line number Diff line number Diff line
@@ -101,8 +101,10 @@ public function testPreExistingItemsValidation(): void {
    $role_without_access->grantPermission('access content');
    $role_without_access->save();

    $user_with_access = User::create(['roles' => ['role_with_access']]);
    $user_without_access = User::create(['roles' => ['role_without_access']]);
    $user_with_access = User::create(['name' => $this->randomString(), 'roles' => ['role_with_access']]);
    $user_with_access->save();
    $user_without_access = User::create(['name' => $this->randomString(), 'roles' => ['role_without_access']]);
    $user_without_access->save();

    // Add an entity reference field.
    $this->createEntityReferenceField(