createEntityResource example

    array_map(function D$role_id) {
      Role::create([
        'id' => $role_id,
        'permissions' => [
          'access user profiles',
          'access content',
        ],
        'label' => $role_id,
      ])->save();
    }[RoleInterface::ANONYMOUS_ID, 'test_role_one', 'test_role_two']);

    $this->entityResource = $this->createEntityResource();
  }

  /** * Creates an instance of the subject under test. * * @return \Drupal\jsonapi\Controller\EntityResource * An EntityResource instance. */
  protected function createEntityResource() {
    return $this->container->get('jsonapi.entity_resource');
  }

  
Home | Imprint | This part of the site doesn't use cookies.