本文整理汇总了PHP中Drupal\simpletest\WebTestBase类的典型用法代码示例。如果您正苦于以下问题:PHP WebTestBase类的具体用法?PHP WebTestBase怎么用?PHP WebTestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebTestBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: installParameters
/**
* Overrides \Drupal\simpletest\WebTestBase::installParameters().
*/
protected function installParameters()
{
$this->siteName = $this->randomMachineName();
$parameters = parent::installParameters();
$parameters['forms']['install_configure_form']['site_name'] = $this->siteName;
return $parameters;
}
开发者ID:HakS,项目名称:drupal8_training,代码行数:10,代码来源:SiteNameTest.php
示例2: 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'));
}
开发者ID:papillon-cendre,项目名称:d8,代码行数:7,代码来源:FileFieldTestBase.php
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
// Install Drupal.
parent::setUp();
// Add the system menu blocks to appropriate regions.
$this->setupExamplesMenus();
}
开发者ID:seongbae,项目名称:drumo-distribution,代码行数:10,代码来源:ExamplesTestBase.php
示例4: 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);
}
开发者ID:alnutile,项目名称:drunatra,代码行数:7,代码来源:reEnableModuleFieldTest.php
示例5: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create and login user.
$this->webUser = $this->drupalCreateUser(array('administer entity_test content'));
$this->drupalLogin($this->webUser);
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:EntityListBuilderTest.php
示例6: 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.');
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:33,代码来源:CommentLanguageTest.php
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->drupalPlaceBlock('local_tasks_block');
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('page_title_block');
}
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:10,代码来源:ParagraphsDemoTest.php
示例8: 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);
}
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:10,代码来源:AdminToolbarToolsAlterTest.php
示例9: 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');
}
开发者ID:318io,项目名称:318-io,代码行数:7,代码来源:DateTimeTest.php
示例10: 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);
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:ToolbarHookToolbarTest.php
示例11: 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);
}
开发者ID:housineali,项目名称:drpl8_dv,代码行数:28,代码来源:ProfileFieldAccessTest.php
示例12: 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());
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:DbLogTest.php
示例13: 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);
}
开发者ID:atif-shaikh,项目名称:DCX-Profile,代码行数:30,代码来源:DevelControllerTest.php
示例14: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$permissions = ['access administration pages', 'administer piwik'];
// User to set up piwik.
$this->admin_user = $this->drupalCreateUser($permissions);
}
开发者ID:rsmccc,项目名称:drupal-bootstrap,代码行数:10,代码来源:PiwikStatusMessagesTest.php
示例15: 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);
}
开发者ID:nstielau,项目名称:drops-8,代码行数:7,代码来源:ToolbarMenuTranslationTest.php
示例16: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
/** @var \Drupal\currency\ConfigImporterInterface $config_importer */
$config_importer = \Drupal::service('currency.config_importer');
$config_importer->importCurrency('EUR');
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentReferenceWebTest.php
示例17: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create a new administrator user for the test.
$admin = $this->drupalCreateUser(array('administer site configuration'));
$this->drupalLogin($admin);
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:DateFormatsMachineNameTest.php
示例18: setUp
protected function setUp()
{
parent::setUp();
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
$this->webUser = $this->drupalCreateUser(array('access content'));
$this->drupalLogin($this->webUser);
}
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:7,代码来源:RebuildTest.php
示例19: setUp
protected function setUp()
{
parent::setUp();
$this->drupalPlaceBlock('page_title_block');
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
// Create a user who can administer text formats, but does not have
// specific permission to use any of them.
$this->filterAdminUser = $this->drupalCreateUser(array('administer filters', 'create page content', 'edit any page content'));
// Create three text formats. Two text formats are created for all users so
// that the drop-down list appears for all tests.
$this->drupalLogin($this->filterAdminUser);
$formats = array();
for ($i = 0; $i < 3; $i++) {
$edit = array('format' => Unicode::strtolower($this->randomMachineName()), 'name' => $this->randomMachineName());
$this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
$this->resetFilterCaches();
$formats[] = FilterFormat::load($edit['format']);
}
list($this->allowedFormat, $this->secondAllowedFormat, $this->disallowedFormat) = $formats;
$this->drupalLogout();
// Create a regular user with access to two of the formats.
$this->webUser = $this->drupalCreateUser(array('create page content', 'edit any page content', $this->allowedFormat->getPermissionName(), $this->secondAllowedFormat->getPermissionName()));
// Create an administrative user who has access to use all three formats.
$this->adminUser = $this->drupalCreateUser(array('administer filters', 'create page content', 'edit any page content', $this->allowedFormat->getPermissionName(), $this->secondAllowedFormat->getPermissionName(), $this->disallowedFormat->getPermissionName()));
$this->drupalPlaceBlock('local_tasks_block');
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:26,代码来源:FilterFormatAccessTest.php
示例20: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create a test user.
$web_user = $this->drupalCreateUser(array('administer entity_test content', 'administer entity_test fields', 'view test entity'));
$this->drupalLogin($web_user);
}
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:10,代码来源:EntityReferenceIntegrationTest.php
注:本文中的Drupal\simpletest\WebTestBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论