本文整理汇总了PHP中Drupal\simpletest\WebTestBase类的典型用法代码示例。如果您正苦于以下问题:PHP WebTestBase类的具体用法?PHP WebTestBase怎么用?PHP WebTestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebTestBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->adminUser = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer node fields', 'administer node display', 'administer nodes', 'bypass node access'));
$this->drupalLogin($this->adminUser);
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
}
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
// Install Drupal.
parent::setUp();
// Add the system menu blocks to appropriate regions.
$this->setupExamplesMenus();
}
示例3: setUp
function setUp()
{
parent::setUp();
$this->drupalCreateContentType(array('type' => 'article'));
$this->article_creator = $this->drupalCreateUser(array('create article content', 'edit own article content'));
$this->drupalLogin($this->article_creator);
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create and login user.
$this->webUser = $this->drupalCreateUser(array('administer entity_test content'));
$this->drupalLogin($this->webUser);
}
示例5: setUp
function setUp()
{
parent::setUp();
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
// Create and login user.
$admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval'));
$this->drupalLogin($admin_user);
// Add language.
$edit = array('predefined_langcode' => 'fr');
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
// Set "Article" content type to use multilingual support.
$edit = array('language_configuration[language_show]' => TRUE);
$this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
// Enable content language negotiation UI.
\Drupal::state()->set('language_test.content_language_type', TRUE);
// Set interface language detection to user and content language detection
// to URL. Disable inheritance from interface language to ensure content
// language will fall back to the default language if no URL language can be
// detected.
$edit = array('language_interface[enabled][language-user]' => TRUE, 'language_content[enabled][language-url]' => TRUE, 'language_content[enabled][language-interface]' => FALSE);
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
// Change user language preference, this way interface language is always
// French no matter what path prefix the URLs have.
$edit = array('preferred_langcode' => 'fr');
$this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
// Create comment field on article.
$this->container->get('comment.manager')->addDefaultField('node', 'article');
// Make comment body translatable.
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
$field_storage->translatable = TRUE;
$field_storage->save();
$this->assertTrue($field_storage->isTranslatable(), 'Comment body is translatable.');
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->drupalPlaceBlock('local_tasks_block');
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('page_title_block');
}
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create and log in an administrative user.
$this->adminUser = $this->drupalCreateUser(['access toolbar', 'access administration pages']);
$this->drupalLogin($this->adminUser);
}
示例8: setUp
protected function setUp()
{
parent::setUp();
// Create admin user and log in admin user.
$this->drupalLogin($this->drupalCreateUser(array('administer site configuration', 'administer content types', 'administer nodes', 'administer node fields', 'administer node form display', 'administer node display')));
$this->drupalPlaceBlock('local_actions_block');
}
示例9: setUp
function setUp()
{
parent::setUp();
// Create an administrative user and log it in.
$this->admin_user = $this->drupalCreateUser(array('access toolbar'));
$this->drupalLogin($this->admin_user);
}
示例10: setUp
function setUp() {
parent::setUp();
$this->type = entity_create('profile_type', [
'id' => 'personal',
'label' => 'Personal data',
'weight' => 0,
'registration' => TRUE,
]);
$this->type->save();
$this->checkPermissions([], TRUE);
$this->admin_user = $this->drupalCreateUser([
'access user profiles',
'administer profile types',
'administer profile fields',
'administer profile display',
'bypass profile access',
]);
$user_permissions = [
'access user profiles',
'add own personal profile',
'edit own personal profile',
'view any personal profile',
];
$this->web_user = $this->drupalCreateUser($user_permissions);
$this->other_user = $this->drupalCreateUser($user_permissions);
}
示例11: setUp
function setUp()
{
parent::setUp();
// Create users with specific permissions.
$this->big_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users'));
$this->any_user = $this->drupalCreateUser(array());
}
示例12: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create a test entity.
$random_label = $this->randomMachineName();
$data = array('type' => 'entity_test', 'name' => $random_label);
$this->entity = entity_create('entity_test', $data);
$this->entity->save();
// Create a test entity with only canonical route.
$random_label = $this->randomMachineName();
$data = array('type' => 'devel_entity_test_canonical', 'name' => $random_label);
$this->entity_canonical = entity_create('devel_entity_test_canonical', $data);
$this->entity_canonical->save();
// Create a test entity with only edit route.
$random_label = $this->randomMachineName();
$data = array('type' => 'devel_entity_test_edit', 'name' => $random_label);
$this->entity_edit = entity_create('devel_entity_test_edit', $data);
$this->entity_edit->save();
// Create a test entity with no routes.
$random_label = $this->randomMachineName();
$data = array('type' => 'devel_entity_test_no_links', 'name' => $random_label);
$this->entity_no_links = entity_create('devel_entity_test_no_links', $data);
$this->entity_no_links->save();
$this->drupalPlaceBlock('local_tasks_block');
$web_user = $this->drupalCreateUser(array('view test entity', 'administer entity_test content', 'access devel information'));
$this->drupalLogin($web_user);
}
示例13: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$permissions = ['access administration pages', 'administer piwik'];
// User to set up piwik.
$this->admin_user = $this->drupalCreateUser($permissions);
}
示例14: setUp
protected function setUp()
{
parent::setUp();
// Create an administrative user and log it in.
$this->adminUser = $this->drupalCreateUser(array('access toolbar', 'translate interface', 'administer languages', 'access administration pages'));
$this->drupalLogin($this->adminUser);
}
示例15: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
/** @var \Drupal\currency\ConfigImporterInterface $config_importer */
$config_importer = \Drupal::service('currency.config_importer');
$config_importer->importCurrency('EUR');
}