• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_role_grant_permissions函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_role_grant_permissions函数的典型用法代码示例。如果您正苦于以下问题:PHP user_role_grant_permissions函数的具体用法?PHP user_role_grant_permissions怎么用?PHP user_role_grant_permissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了user_role_grant_permissions函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     // Enable anonymous and authenticated user comments.
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access comments', 'post comments', 'skip comment approval'));
     user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array('access comments', 'post comments', 'skip comment approval'));
 }
开发者ID:komejo,项目名称:article-test,代码行数:7,代码来源:CommentAnonymousTest.php


示例2: testUserRegisterForm

 /**
  * Test user registration integration.
  */
 public function testUserRegisterForm()
 {
     $id = $this->type->id();
     $field_name = $this->field->getName();
     $this->field->setRequired(TRUE);
     $this->field->save();
     // Allow registration without administrative approval and log in user
     // directly after registering.
     \Drupal::configFactory()->getEditable('user.settings')->set('register', USER_REGISTER_VISITORS)->set('verify_mail', 0)->save();
     user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, ['view own test profile']);
     // Verify that the additional profile field is attached and required.
     $name = $this->randomMachineName();
     $pass_raw = $this->randomMachineName();
     $edit = ['name' => $name, 'mail' => $this->randomMachineName() . '@example.com', 'pass[pass1]' => $pass_raw, 'pass[pass2]' => $pass_raw];
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->assertRaw(new FormattableMarkup('@name field is required.', ['@name' => $this->field->getLabel()]));
     // Verify that we can register.
     $edit["entity_" . $id . "[{$field_name}][0][value]"] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Create new account'));
     $this->assertText(new FormattableMarkup('Registration successful. You are now logged in.', []));
     $new_user = user_load_by_name($name);
     $this->assertTrue($new_user->isActive(), 'New account is active after registration.');
     // Verify that a new profile was created for the new user ID.
     $profile = \Drupal::entityTypeManager()->getStorage('profile')->loadByUser($new_user, $this->type->id());
     $this->assertEqual($profile->get($field_name)->value, $edit["entity_" . $id . "[{$field_name}][0][value]"], 'Field value found in loaded profile.');
     // Verify that the profile field value appears on the user account page.
     $this->drupalGet('user');
     $this->assertText($edit["entity_" . $id . "[{$field_name}][0][value]"], 'Field value found on user account page.');
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:32,代码来源:ProfileAttachTest.php


示例3: testCommentFieldName

 /**
  * Test comment field name.
  */
 public function testCommentFieldName()
 {
     /** @var \Drupal\Core\Render\RendererInterface $renderer */
     $renderer = \Drupal::service('renderer');
     $view = Views::getView('test_comment_field_name');
     $this->executeView($view);
     $expected_result = [['cid' => $this->comment->id(), 'field_name' => $this->comment->getFieldName()], ['cid' => $this->customComment->id(), 'field_name' => $this->customComment->getFieldName()]];
     $column_map = ['cid' => 'cid', 'comment_field_data_field_name' => 'field_name'];
     $this->assertIdenticalResultset($view, $expected_result, $column_map);
     // Test that no data can be rendered.
     $this->assertIdentical(FALSE, isset($view->field['field_name']));
     // Grant permission to properly check view access on render.
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
     $this->container->get('account_switcher')->switchTo(new AnonymousUserSession());
     $view = Views::getView('test_comment_field_name');
     $this->executeView($view);
     // Test that data rendered.
     $output = $renderer->executeInRenderContext(new RenderContext(), function () use($view) {
         return $view->field['field_name']->advancedRender($view->result[0]);
     });
     $this->assertIdentical($this->comment->getFieldName(), $output);
     $output = $renderer->executeInRenderContext(new RenderContext(), function () use($view) {
         return $view->field['field_name']->advancedRender($view->result[1]);
     });
     $this->assertIdentical($this->customComment->getFieldName(), $output);
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:29,代码来源:CommentFieldNameTest.php


示例4: setUp

 function setUp()
 {
     parent::setUp();
     // Enable anonymous and authenticated user comments.
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments', 'post comments', 'skip comment approval'));
     user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access comments', 'post comments', 'skip comment approval'));
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:7,代码来源:CommentAnonymousTest.php


示例5: testConfigChangePageCache

 /**
  * Tests that configuration changes also clear the page cache.
  */
 public function testConfigChangePageCache()
 {
     $this->enableService('entity:entity_test', 'GET');
     // Allow anonymous users to issue GET requests.
     $permissions = $this->entityPermissions('entity_test', 'view');
     $permissions[] = 'restful get entity:entity_test';
     user_role_grant_permissions('anonymous', $permissions);
     // Create an entity programmatically.
     $entity = $this->entityCreate('entity_test');
     $entity->set('field_test_text', 'custom cache tag value');
     $entity->save();
     // Read it over the REST API.
     $this->httpRequest($entity->urlInfo()->setRouteParameter('_format', $this->defaultFormat), 'GET', NULL, $this->defaultMimeType);
     $this->assertResponse(200, 'HTTP response code is correct.');
     $this->assertHeader('x-drupal-cache', 'MISS');
     $this->assertCacheTag('config:rest.settings');
     $this->assertCacheTag('entity_test:1');
     $this->assertCacheTag('entity_test_access:field_test_text');
     // Read it again, should be page-cached now.
     $this->httpRequest($entity->urlInfo()->setRouteParameter('_format', $this->defaultFormat), 'GET', NULL, $this->defaultMimeType);
     $this->assertResponse(200, 'HTTP response code is correct.');
     $this->assertHeader('x-drupal-cache', 'HIT');
     $this->assertCacheTag('config:rest.settings');
     $this->assertCacheTag('entity_test:1');
     $this->assertCacheTag('entity_test_access:field_test_text');
     // Trigger a config save which should clear the page cache, so we should get
     // a cache miss now for the same request.
     $this->config('rest.settings')->save();
     $this->httpRequest($entity->urlInfo()->setRouteParameter('_format', $this->defaultFormat), 'GET', NULL, $this->defaultMimeType);
     $this->assertResponse(200, 'HTTP response code is correct.');
     $this->assertHeader('x-drupal-cache', 'MISS');
     $this->assertCacheTag('config:rest.settings');
     $this->assertCacheTag('entity_test:1');
     $this->assertCacheTag('entity_test_access:field_test_text');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:38,代码来源:PageCacheTest.php


示例6: setupPermissionTestData

 /**
  * Set some test data for permission related tests.
  */
 protected function setupPermissionTestData()
 {
     // Setup a role without any permission.
     $this->roleStorage->create(array('id' => 'authenticated'))->save();
     $this->roleStorage->create(array('id' => 'no_permission'))->save();
     // Setup a role with just one permission.
     $this->roleStorage->create(array('id' => 'one_permission'))->save();
     user_role_grant_permissions('one_permission', array('administer permissions'));
     // Setup a role with multiple permissions.
     $this->roleStorage->create(array('id' => 'multiple_permissions'))->save();
     user_role_grant_permissions('multiple_permissions', array('administer permissions', 'administer users', 'access user profiles'));
     // Setup a user without an extra role.
     $this->users[] = $account = $this->userStorage->create(['name' => $this->randomString()]);
     $account->save();
     // Setup a user with just the first role (so no permission beside the
     // ones from the authenticated role).
     $this->users[] = $account = $this->userStorage->create(array('name' => 'first_role'));
     $account->addRole('no_permission');
     $account->save();
     // Setup a user with just the second role (so one additional permission).
     $this->users[] = $account = $this->userStorage->create(array('name' => 'second_role'));
     $account->addRole('one_permission');
     $account->save();
     // Setup a user with both the second and the third role.
     $this->users[] = $account = $this->userStorage->create(array('name' => 'second_third_role'));
     $account->addRole('one_permission');
     $account->addRole('multiple_permissions');
     $account->save();
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:32,代码来源:UserKernelTestBase.php


示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     // Enable user signatures.
     \Drupal::config('user.settings')->set('signatures', 1)->save();
     // Create Basic page node type.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Add a comment field with commenting enabled by default.
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
     // Prefetch and create text formats.
     $this->filtered_html_format = entity_create('filter_format', array('format' => 'filtered_html_format', 'name' => 'Filtered HTML', 'weight' => -1, 'filters' => array('filter_html' => array('module' => 'filter', 'status' => TRUE, 'settings' => array('allowed_html' => '<a> <em> <strong>')))));
     $this->filtered_html_format->save();
     $this->full_html_format = entity_create('filter_format', array('format' => 'full_html', 'name' => 'Full HTML'));
     $this->full_html_format->save();
     user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array($this->filtered_html_format->getPermissionName()));
     // Create regular and administrative users.
     $this->web_user = $this->drupalCreateUser(array('post comments'));
     $admin_permissions = array('post comments', 'administer comments', 'administer user form display', 'administer account settings');
     foreach (filter_formats() as $format) {
         if ($permission = $format->getPermissionName()) {
             $admin_permissions[] = $permission;
         }
     }
     $this->admin_user = $this->drupalCreateUser($admin_permissions);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:25,代码来源:UserSignatureTest.php


示例8: testInactiveDomain

 public function testInactiveDomain()
 {
     // Create three new domains programmatically.
     $this->domainCreateTestDomains(3);
     $domains = \Drupal::service('domain.loader')->loadMultiple();
     // Grab the last domain for testing.
     $domain = end($domains);
     $this->drupalGet($domain->getPath());
     $this->assertTrue($domain->status(), 'Tested domain is set to active.');
     $this->assertTrue($domain->getPath() == $this->getUrl(), 'Loaded the active domain.');
     // Disable the domain and test for redirect.
     $domain->disable();
     $default = \Drupal::service('domain.loader')->loadDefaultDomain();
     // Must flush cache.
     drupal_flush_all_caches();
     $this->drupalGet($domain->getPath());
     $this->assertFalse($domain->status(), 'Tested domain is set to inactive.');
     $this->assertTrue($default->getPath() == $this->getUrl(), 'Redirected an inactive domain to the default domain.');
     // Try to access with the proper permission.
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access inactive domains'));
     $this->assertFalse($domain->status(), 'Tested domain is set to inactive.');
     // Must flush cache.
     drupal_flush_all_caches();
     $this->drupalGet($domain->getPath());
     $this->assertTrue($domain->getPath() == $this->getUrl(), 'Loaded the inactive domain with permission.');
 }
开发者ID:dropdog,项目名称:play,代码行数:26,代码来源:DomainInactiveTest.php


示例9: testContactStorage

 /**
  * Tests configuration options and the site-wide contact form.
  */
 public function testContactStorage()
 {
     // Create and login administrative user.
     $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer users', 'administer account settings', 'administer contact_message fields'));
     $this->drupalLogin($admin_user);
     // Create first valid contact form.
     $mail = '[email protected]';
     $this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, ['send_a_pony' => 1]);
     $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
     // Ensure that anonymous can submit site-wide contact form.
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access site-wide contact form'));
     $this->drupalLogout();
     $this->drupalGet('contact');
     $this->assertText(t('Your email address'));
     $this->assertNoText(t('Form'));
     $this->submitContact($name = $this->randomMachineName(16), $mail, $subject = $this->randomMachineName(16), $id, $message = $this->randomMachineName(64));
     $this->assertText(t('Your message has been sent.'));
     $messages = Message::loadMultiple();
     /** @var \Drupal\contact\Entity\Message $message */
     $message = reset($messages);
     $this->assertEqual($message->getContactForm()->id(), $id);
     $this->assertTrue($message->getContactForm()->getThirdPartySetting('contact_storage_test', 'send_a_pony', FALSE));
     $this->assertEqual($message->getSenderName(), $name);
     $this->assertEqual($message->getSubject(), $subject);
     $this->assertEqual($message->getSenderMail(), $mail);
     $config = $this->config("contact.form.{$id}");
     $this->assertEqual($config->get('id'), $id);
 }
开发者ID:ravibarnwal,项目名称:laraitassociate.in,代码行数:31,代码来源:ContactStorageTest.php


示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('local_tasks_block');
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('page_title_block');
     $this->type = $this->createProfileType('test', 'Test profile', TRUE);
     $id = $this->type->id();
     $field_storage = FieldStorageConfig::create(['field_name' => 'profile_fullname', 'entity_type' => 'profile', 'type' => 'text']);
     $field_storage->save();
     $this->field = FieldConfig::create(['field_storage' => $field_storage, 'bundle' => $this->type->id(), 'label' => 'Full name']);
     $this->field->save();
     // Configure the default display.
     $this->display = EntityViewDisplay::load("profile.{$this->type->id()}.default");
     if (!$this->display) {
         $this->display = EntityViewDisplay::create(['targetEntityType' => 'profile', 'bundle' => $this->type->id(), 'mode' => 'default', 'status' => TRUE]);
         $this->display->save();
     }
     $this->display->setComponent($this->field->getName(), ['type' => 'string'])->save();
     // Configure rhe default form.
     $this->form = EntityFormDisplay::load("profile.{$this->type->id()}.default");
     if (!$this->form) {
         $this->form = EntityFormDisplay::create(['targetEntityType' => 'profile', 'bundle' => $this->type->id(), 'mode' => 'default', 'status' => TRUE]);
         $this->form->save();
     }
     $this->form->setComponent($this->field->getName(), ['type' => 'string_textfield'])->save();
     $this->checkPermissions(['administer profile types', "view own {$id} profile", "view any {$id} profile", "add own {$id} profile", "add any {$id} profile", "edit own {$id} profile", "edit any {$id} profile", "delete own {$id} profile", "delete any {$id} profile"]);
     user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, ['access user profiles']);
     $this->adminUser = $this->drupalCreateUser(['administer profile types', "view any {$id} profile", "add any {$id} profile", "edit any {$id} profile", "delete any {$id} profile"]);
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:33,代码来源:ProfileTestBase.php


示例11: testContactStorage

 /**
  * Tests configuration options and the site-wide contact form.
  */
 public function testContactStorage()
 {
     // Create and login administrative user.
     $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer users', 'administer account settings', 'administer contact_message fields'));
     $this->drupalLogin($admin_user);
     // Create first valid category.
     $mail = '[email protected]';
     $this->addCategory($id = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($mail)), '', TRUE);
     $this->assertRaw(t('Category %label has been added.', array('%label' => $label)));
     // Ensure that anonymous can submit site-wide contact form.
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
     $this->drupalLogout();
     $this->drupalGet('contact');
     $this->assertText(t('Your email address'));
     $this->assertNoText(t('Category'));
     $this->submitContact($name = $this->randomName(16), $mail, $subject = $this->randomName(16), $id, $message = $this->randomName(64));
     $this->assertText(t('Your message has been sent.'));
     $messages = Message::loadMultiple();
     /** @var \Drupal\contact\Entity\Message $message */
     $message = reset($messages);
     $this->assertEqual($message->getCategory()->id(), $id);
     $this->assertEqual($message->getSenderName(), $name);
     $this->assertEqual($message->getSubject(), $subject);
     $this->assertEqual($message->getSenderMail(), $mail);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:28,代码来源:ContactStorageTest.php


示例12: setUp

 function setUp()
 {
     parent::setUp();
     // Create an administrative user.
     $this->admin_user = $this->drupalCreateUser(array('administer site configuration'));
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user profiles'));
     user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access user profiles'));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:PageNotFoundTest.php


示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create an administrative user.
     $this->adminUser = $this->drupalCreateUser(array('administer site configuration', 'link to any page'));
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access user profiles'));
     user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array('access user profiles'));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:8,代码来源:PageNotFoundTest.php


示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     $filtered_html_format = entity_create('filter_format', array('format' => 'filtered_html', 'name' => 'Filtered HTML'));
     $filtered_html_format->save();
     $filtered_html_permission = $filtered_html_format->getPermissionName();
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array($filtered_html_permission));
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:8,代码来源:FormTest.php


示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     $permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval');
     $this->user = $this->drupalCreateUser($permissions);
     $this->otherUser = $this->drupalCreateUser($permissions);
     $this->addDefaultCommentField('node', 'page');
     user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, array('access content', 'access user profiles'));
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:10,代码来源:TrackerTest.php


示例16: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('page_title_block');
     // Create an administrative user.
     $this->adminUser = $this->drupalCreateUser(['access administration pages', 'administer site configuration', 'link to any page', 'administer blocks']);
     $this->adminUser->roles[] = 'administrator';
     $this->adminUser->save();
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access user profiles'));
     user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array('access user profiles'));
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:11,代码来源:AccessDeniedTest.php


示例17: setUp

 protected function setUp()
 {
     parent::setUp();
     // Create Basic page node type.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     /** @var \Drupal\filter\Entity\FilterFormat $filtered_html_format */
     $filtered_html_format = entity_load('filter_format', 'filtered_html');
     $filtered_html_permission = $filtered_html_format->getPermissionName();
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array($filtered_html_permission));
     $this->adminUser = $this->drupalCreateUser(array('administer modules', 'administer filters', 'administer site configuration'));
     $this->drupalLogin($this->adminUser);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:12,代码来源:FilterSecurityTest.php


示例18: createUser

 /**
  * Creates a user.
  *
  * @param array $values
  *   (optional) The values used to create the entity.
  * @param array $permissions
  *   (optional) Array of permission names to assign to user. The
  *   users_roles tables must be installed before this can be used.
  *
  * @return \Drupal\user\Entity\User
  *   The created user entity.
  */
 protected function createUser($values = array(), $permissions = array())
 {
     if ($permissions) {
         // Create a new role and apply permissions to it.
         $role = entity_create('user_role', array('id' => strtolower($this->randomName(8)), 'label' => $this->randomName(8)));
         $role->save();
         user_role_grant_permissions($role->id(), $permissions);
         $values['roles'][] = $role->id();
     }
     $account = entity_create('user', $values + array('name' => $this->randomName(), 'status' => 1));
     $account->enforceIsNew();
     $account->save();
     return $account;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:26,代码来源:EntityUnitTestBase.php


示例19: testContactStorage

 /**
  * Tests contact messages submitted through contact form.
  */
 public function testContactStorage()
 {
     // Create and login administrative user.
     $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer users', 'administer account settings', 'administer contact_message fields'));
     $this->drupalLogin($admin_user);
     // Create first valid contact form.
     $mail = '[email protected]';
     $this->addContactForm('test_id', 'test_label', $mail, '', TRUE);
     $this->assertText(t('Contact form test_label has been added.'));
     // Ensure that anonymous can submit site-wide contact form.
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
     $this->drupalLogout();
     $this->drupalGet('contact');
     $this->assertText(t('Your email address'));
     $this->assertNoText(t('Form'));
     $this->submitContact('Test_name', $mail, 'Test_subject', 'test_id', 'Test_message');
     $this->assertText(t('Your message has been sent.'));
     // Login as admin,check the message list overview.
     $this->drupalLogin($admin_user);
     $this->drupalGet('admin/structure/contact/messages');
     $rows = $this->xpath('//tbody/tr');
     // Make sure only 1 message is available.
     $this->assertEqual(count($rows), 1);
     // Some fields should be present.
     $this->assertText('Test_subject');
     $this->assertText('Test_name');
     $this->assertText('test_label');
     // Make sure the stored message is correct.
     $this->clickLink(t('Edit'));
     $this->assertFieldById('edit-name', 'Test_name');
     $this->assertFieldById('edit-mail', $mail);
     $this->assertFieldById('edit-subject-0-value', 'Test_subject');
     $this->assertFieldById('edit-message-0-value', 'Test_message');
     // Submit should redirect back to listing.
     $this->drupalPostForm(NULL, array(), t('Save'));
     $this->assertUrl('admin/structure/contact/messages');
     // Delete the message.
     $this->clickLink(t('Delete'));
     $this->drupalPostForm(NULL, NULL, t('Delete'));
     $this->assertText('Deleted contact message Test_subject.');
     // Make sure no messages are available.
     $this->assertText('There is no Contact message yet.');
     // Fill the redirect field and assert the page is successfully redirected.
     $edit = ['contact_storage_uri' => 'entity:user/' . $admin_user->id()];
     $this->drupalPostForm('admin/structure/contact/manage/test_id', $edit, t('Save'));
     $edit = ['subject[0][value]' => 'Test subject', 'message[0][value]' => 'Test message'];
     $this->drupalPostForm('contact', $edit, t('Send message'));
     $this->assertText('Your message has been sent.');
     $this->assertEqual($this->url, $admin_user->urlInfo()->setAbsolute()->toString());
 }
开发者ID:DrupalCamp-NYC,项目名称:dcnyc16,代码行数:53,代码来源:ContactStorageTest.php


示例20: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Set up the filter formats used by this test.
     $basic_html_format = entity_create('filter_format', array('format' => 'basic_html', 'name' => 'Basic HTML', 'filters' => array('filter_html' => array('status' => 1, 'settings' => array('allowed_html' => '<p> <br> <strong> <a> <em>')))));
     $basic_html_format->save();
     $restricted_html_format = entity_create('filter_format', array('format' => 'restricted_html', 'name' => 'Restricted HTML', 'filters' => array('filter_html' => array('status' => TRUE, 'weight' => -10, 'settings' => array('allowed_html' => '<p> <br> <strong> <a> <em> <h4>')), 'filter_autop' => array('status' => TRUE, 'weight' => 0), 'filter_url' => array('status' => TRUE, 'weight' => 0), 'filter_htmlcorrector' => array('status' => TRUE, 'weight' => 10))));
     $restricted_html_format->save();
     $full_html_format = entity_create('filter_format', array('format' => 'full_html', 'name' => 'Full HTML', 'weight' => 1, 'filters' => array()));
     $full_html_format->save();
     $this->adminUser = $this->drupalCreateUser(array('administer filters', $basic_html_format->getPermissionName(), $restricted_html_format->getPermissionName(), $full_html_format->getPermissionName()));
     $this->webUser = $this->drupalCreateUser(array('create page content', 'edit own page content'));
     user_role_grant_permissions('authenticated', array($basic_html_format->getPermissionName()));
     user_role_grant_permissions('anonymous', array($restricted_html_format->getPermissionName()));
     $this->drupalLogin($this->adminUser);
 }
开发者ID:brstde,项目名称:gap1,代码行数:20,代码来源:FilterAdminTest.php



注:本文中的user_role_grant_permissions函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_role_names函数代码示例发布时间:2022-05-23
下一篇:
PHP user_role_change_permissions函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap