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

PHP Tests\ViewUnitTestBase类代码示例

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

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



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

示例1: viewsData

 /**
  * Overrides \Drupal\views\Tests\ViewUnitTestBase::viewsData().
  */
 public function viewsData()
 {
     $data = parent::viewsData();
     $date_plugins = array('date_fulldate', 'date_day', 'date_month', 'date_week', 'date_year', 'date_year_month');
     foreach ($date_plugins as $plugin_id) {
         $data['views_test_data'][$plugin_id] = $data['views_test_data']['created'];
         $data['views_test_data'][$plugin_id]['real field'] = 'created';
         $data['views_test_data'][$plugin_id]['argument']['id'] = $plugin_id;
     }
     return $data;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:14,代码来源:ArgumentDateTest.php


示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     ViewTestData::createTestViews(get_class($this), array('entity_reference_test_views'));
     $field_storage = FieldStorageConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'field_test', 'type' => 'entity_reference', 'settings' => array('target_type' => 'entity_test'), 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED));
     $field_storage->save();
     $field = FieldConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'field_test', 'bundle' => 'entity_test', 'settings' => array('handler' => 'default', 'handler_settings' => array())));
     $field->save();
     // Create some test entities which link each other.
     $entity_storage = \Drupal::entityManager()->getStorage('entity_test');
     $referenced_entity = $entity_storage->create(array());
     $referenced_entity->save();
     $this->entities[$referenced_entity->id()] = $referenced_entity;
     $entity = $entity_storage->create(array());
     $entity->field_test->target_id = $referenced_entity->id();
     $entity->save();
     $this->assertEqual($entity->field_test[0]->entity->id(), $referenced_entity->id());
     $this->entities[$entity->id()] = $entity;
     $entity = $entity_storage->create(array());
     $entity->field_test->target_id = $referenced_entity->id();
     $entity->save();
     $this->assertEqual($entity->field_test[0]->entity->id(), $referenced_entity->id());
     $this->entities[$entity->id()] = $entity;
     Views::viewsData()->clear();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:30,代码来源:EntityReferenceRelationshipTest.php


示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Install the necessary dependencies for node type creation to work.
     $this->installEntitySchema('node');
     $this->installConfig(array('field', 'node'));
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:10,代码来源:ViewEntityDependenciesTest.php


示例4: viewsData

 /**
  * {@inheritdoc}
  */
 protected function viewsData()
 {
     $data = parent::viewsData();
     $data['views_test_data']['name']['field']['id'] = 'file_extension';
     $data['views_test_data']['name']['real field'] = 'name';
     return $data;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:10,代码来源:ExtensionViewsFieldTest.php


示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('language'));
     $this->enableModules(array('views_ui'));
     $this->wizard = $this->container->get('plugin.manager.views.wizard')->createInstance('standard:views_test_data', array());
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:WizardPluginBaseUnitTest.php


示例6: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->storage = $this->container->get('entity.manager')->getStorage('entity_test');
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:10,代码来源:QueryGroupByTest.php


示例7: viewsData

 function viewsData()
 {
     $data = parent::viewsData();
     $data['views_test_data']['age']['filter']['allow empty'] = TRUE;
     $data['views_test_data']['id']['filter']['allow empty'] = FALSE;
     return $data;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:7,代码来源:FilterNumericTest.php


示例8: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp($import_test_views = TRUE)
 {
     parent::setUp($import_test_views);
     $this->installEntitySchema('user');
     $this->installEntitySchema('comment');
     // Create the anonymous role.
     $this->installConfig(['user']);
     // Create an anonymous user.
     $storage = \Drupal::entityManager()->getStorage('user');
     // Insert a row for the anonymous user.
     $storage->create(array('uid' => 0, 'status' => 0))->save();
     $admin_role = Role::create(['id' => 'admin', 'permissions' => ['administer comments', 'access user profiles']]);
     $admin_role->save();
     /* @var \Drupal\user\RoleInterface $anonymous_role */
     $anonymous_role = Role::load(Role::ANONYMOUS_ID);
     $anonymous_role->grantPermission('access comments');
     $anonymous_role->save();
     $this->adminUser = User::create(['name' => $this->randomMachineName(), 'roles' => [$admin_role->id()]]);
     $this->adminUser->save();
     // Create some comments.
     $comment = Comment::create(['subject' => 'My comment title', 'uid' => $this->adminUser->id(), 'entity_type' => 'entity_test', 'comment_type' => 'entity_test', 'status' => 1]);
     $comment->save();
     $comment_anonymous = Comment::create(['subject' => 'Anonymous comment title', 'uid' => 0, 'name' => 'barry', 'mail' => '[email protected]', 'homepage' => 'https://example.com', 'entity_type' => 'entity_test', 'comment_type' => 'entity_test', 'created' => 123456, 'status' => 1]);
     $comment_anonymous->save();
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:28,代码来源:CommentUserNameTest.php


示例9: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('taxonomy_term');
     $this->installConfig(array('taxonomy'));
     \Drupal::service('router.builder')->rebuild();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:10,代码来源:RowEntityTest.php


示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Setup the needed tables in order to make the drupal router working.
     $this->installSchema('system', array('url_alias'));
     $this->installSchema('menu_link', 'menu_links');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:10,代码来源:DisplayPageTest.php


示例11: viewsData

 /**
  * {@inheritdoc}
  */
 protected function viewsData()
 {
     $data = parent::viewsData();
     $data['views_test_data']['table']['base']['access query tag'] = 'test_tag';
     $data['views_test_data']['table']['base']['query metadata'] = array('key1' => 'test_metadata', 'key2' => 'test_metadata2');
     return $data;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:10,代码来源:SqlQueryTest.php


示例12: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->enableModules(array('system', 'dblog'));
     $this->installSchema('dblog', array('watchdog'));
     ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:ViewsIntegrationTest.php


示例13: viewsData

 /**
  * Overrides Drupal\views\Tests\ViewTestBase::viewsData().
  */
 protected function viewsData()
 {
     $data = parent::viewsData();
     $data['views_test_data']['job']['field']['id'] = 'test_field';
     $data['views_test_data']['job']['field']['click sortable'] = FALSE;
     $data['views_test_data']['id']['field']['click sortable'] = TRUE;
     return $data;
 }
开发者ID:jeyram,项目名称:camp-gdl,代码行数:11,代码来源:FieldUnitTest.php


示例14: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Rebuild the router, otherwise we can't generate links.
     $this->container->get('router.builder')->rebuild();
     $this->installSchema('dblog', array('watchdog'));
     ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:11,代码来源:ViewsIntegrationTest.php


示例15: dataSet

 /**
  * {@inheritdoc}
  */
 public function dataSet()
 {
     $datas = parent::dataSet();
     foreach ($datas as $i => $data) {
         $datas[$i]['destroyed'] = gmmktime(0, 0, 0, 1, 1, 2050);
     }
     return $datas;
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:11,代码来源:FieldDateTest.php


示例16: dataSet

 /**
  * Add more items to the test set, to make the order tests more robust.
  *
  * In total we have then 60 entries, which makes a probability of a collision
  * of 1/60!, which is around 1/1E80, which is higher than the estimated amount
  * of protons / electrons in the observable universe, also called the
  * eddington number.
  *
  * @see http://en.wikipedia.org/wiki/Eddington_number
  */
 protected function dataSet()
 {
     $data = parent::dataSet();
     for ($i = 0; $i < 55; $i++) {
         $data[] = array('name' => 'name_' . $i, 'age' => $i, 'job' => 'job_' . $i, 'created' => rand(0, time()), 'status' => 1);
     }
     return $data;
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:18,代码来源:SortRandomTest.php


示例17: setUpFixtures

 /**
  * {@inheritdoc}
  */
 protected function setUpFixtures()
 {
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->installConfig(['entity_test']);
     Block::create(['id' => 'test_block', 'plugin' => 'system_main_block'])->save();
     parent::setUpFixtures();
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:11,代码来源:AreaEntityTest.php


示例18: viewsData

 /**
  * Overrides Drupal\views\Tests\ViewTestBase::viewsData().
  */
 protected function viewsData()
 {
     $data = parent::viewsData();
     // User the existing test_filter plugin.
     $data['views_test_data_alias']['table']['real table'] = 'views_test_data';
     $data['views_test_data_alias']['name_alias']['filter']['id'] = 'test_filter';
     $data['views_test_data_alias']['name_alias']['filter']['real field'] = 'name';
     return $data;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:12,代码来源:HandlerAliasTest.php


示例19: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->installEntitySchema('entity_test_mul');
     $this->storage = $this->container->get('entity.manager')->getStorage('entity_test');
     ConfigurableLanguage::createFromLangcode('it')->save();
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:12,代码来源:QueryGroupByTest.php


示例20: setUp

 protected function setUp()
 {
     parent::setUp();
     ViewTestData::createTestViews(get_class($this), array('user_test_views'));
     $this->installEntitySchema('user');
     $entity_manager = $this->container->get('entity.manager');
     $this->roleStorage = $entity_manager->getStorage('user_role');
     $this->userStorage = $entity_manager->getStorage('user');
 }
开发者ID:dev981,项目名称:gaptest,代码行数:9,代码来源:UserUnitTestBase.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Dsc\System类代码示例发布时间:2022-05-23
下一篇:
PHP Tests\ViewTestData类代码示例发布时间: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