/**
  * {@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();
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Install the necessary dependencies for node type creation to work.
     $this->installEntitySchema('node');
     $this->installConfig(array('field', 'node'));
 }
コード例 #3
0
 /**
  * {@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;
 }
コード例 #4
0
 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());
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->storage = $this->container->get('entity.manager')->getStorage('entity_test');
 }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: CommentUserNameTest.php プロジェクト: nsp15/Drupal8
 /**
  * {@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' => '*****@*****.**', 'homepage' => 'https://example.com', 'entity_type' => 'entity_test', 'comment_type' => 'entity_test', 'created' => 123456, 'status' => 1]);
     $comment_anonymous->save();
 }
コード例 #8
0
ファイル: RowEntityTest.php プロジェクト: nstielau/drops-8
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('taxonomy_term');
     $this->installConfig(array('taxonomy'));
     \Drupal::service('router.builder')->rebuild();
 }
コード例 #9
0
ファイル: DisplayPageTest.php プロジェクト: alnutile/drunatra
 /**
  * {@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');
 }
コード例 #10
0
 /**
  * {@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;
 }
コード例 #11
0
 /**
  * {@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'));
 }
コード例 #12
0
ファイル: FieldUnitTest.php プロジェクト: jeyram/camp-gdl
 /**
  * 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;
 }
コード例 #13
0
 /**
  * {@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'));
 }
コード例 #14
0
ファイル: FieldDateTest.php プロジェクト: nsp15/Drupal8
 /**
  * {@inheritdoc}
  */
 public function dataSet()
 {
     $datas = parent::dataSet();
     foreach ($datas as $i => $data) {
         $datas[$i]['destroyed'] = gmmktime(0, 0, 0, 1, 1, 2050);
     }
     return $datas;
 }
コード例 #15
0
ファイル: SortRandomTest.php プロジェクト: nsp15/Drupal8
 /**
  * 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;
 }
コード例 #16
0
ファイル: AreaEntityTest.php プロジェクト: nsp15/Drupal8
 /**
  * {@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();
 }
コード例 #17
0
ファイル: HandlerAliasTest.php プロジェクト: nstielau/drops-8
 /**
  * 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;
 }
コード例 #18
0
 /**
  * {@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();
 }
コード例 #19
0
ファイル: UserUnitTestBase.php プロジェクト: dev981/gaptest
 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');
 }
コード例 #20
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('aggregator_item');
     $this->installEntitySchema('aggregator_feed');
     ViewTestData::createTestViews(get_class($this), array('aggregator_test_views'));
     $this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item');
     $this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed');
 }
コード例 #21
0
 /**
  * Overrides \Drupal\views\Tests\ViewTestBase::dataSet().
  */
 protected function dataSet()
 {
     $data = parent::dataSet();
     $data[0]['langcode'] = 'en';
     $data[1]['langcode'] = 'xx-lolspeak';
     $data[2]['langcode'] = '';
     $data[3]['langcode'] = '';
     $data[4]['langcode'] = '';
     return $data;
 }
コード例 #22
0
ファイル: FilterStringTest.php プロジェクト: nstielau/drops-8
 /**
  * An extended test dataset.
  */
 protected function dataSet()
 {
     $dataset = parent::dataSet();
     $dataset[0]['description'] = 'John Winston Ono Lennon, MBE (9 October 1940 – 8 December 1980) was an English musician and singer-songwriter who rose to worldwide fame as one of the founding members of The Beatles, one of the most commercially successful and critically acclaimed acts in the history of popular music. Along with fellow Beatle Paul McCartney, he formed one of the most successful songwriting partnerships of the 20th century.';
     $dataset[1]['description'] = 'George Harrison,[1] MBE (25 February 1943 – 29 November 2001)[2] was an English rock guitarist, singer-songwriter, actor and film producer who achieved international fame as lead guitarist of The Beatles.';
     $dataset[2]['description'] = 'Richard Starkey, MBE (born 7 July 1940), better known by his stage name Ringo Starr, is an English musician, singer-songwriter, and actor who gained worldwide fame as the drummer for The Beatles.';
     $dataset[3]['description'] = 'Sir James Paul McCartney, MBE (born 18 June 1942) is an English musician, singer-songwriter and composer. Formerly of The Beatles (1960–1970) and Wings (1971–1981), McCartney is the most commercially successful songwriter in the history of popular music, according to Guinness World Records.[1]';
     $dataset[4]['description'] = NULL;
     return $dataset;
 }
コード例 #23
0
ファイル: ArgumentDateTest.php プロジェクト: nstielau/drops-8
 /**
  * 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;
 }
 /**
  * {@inheritdoc}
  */
 protected function dataSet()
 {
     $data = parent::dataSet();
     foreach ($data as &$row) {
         if ($row['status']) {
             $row['status'] = 'Enabled';
         } else {
             $row['status'] = '';
         }
     }
     return $data;
 }
コード例 #25
0
 /**
  * {@inheritdoc}
  */
 protected function setUpFixtures()
 {
     parent::setUpFixtures();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     // Create some test entities.
     for ($i = 0; $i < 5; $i++) {
         EntityTest::create(['name' => $this->randomString()])->save();
     }
     // Create and admin user.
     $this->adminUser = $this->createUser([], FALSE, TRUE);
 }
コード例 #26
0
 protected function setUpFixtures()
 {
     $this->installEntitySchema('user');
     $this->installEntitySchema('node');
     $this->installEntitySchema('comment');
     $this->installSchema('comment', array('comment_entity_statistics'));
     $this->installConfig(array('field'));
     entity_create('node_type', array('type' => 'page', 'name' => 'Page'))->save();
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
     parent::setUpFixtures();
     $this->installConfig(array('filter'));
 }
コード例 #27
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->installEntitySchema('entity_test_mul');
     // Create reference from entity_test to entity_test_mul.
     $this->createEntityReferenceField('entity_test', 'entity_test', 'field_test_data', 'field_test_data', 'entity_test_mul');
     // Create reference from entity_test_mul to entity_test.
     $this->createEntityReferenceField('entity_test_mul', 'entity_test_mul', 'field_data_test', 'field_data_test', 'entity_test');
     ViewTestData::createTestViews(get_class($this), array('entity_reference_test_views'));
 }
コード例 #28
0
 /**
  * {@inheritdoc}
  */
 protected function setUp($import_test_views = TRUE)
 {
     parent::setUp($import_test_views);
     $this->installEntitySchema('user');
     $role_with_access = Role::create(['id' => 'with_access', 'permissions' => ['view test entity field']]);
     $role_with_access->save();
     $role_without_access = Role::create(['id' => 'without_access', 'permissions' => []]);
     $role_without_access->save();
     $this->userWithAccess = User::create(['name' => $this->randomMachineName(), 'roles' => [$role_with_access->id()]]);
     $this->userWithAccess->save();
     $this->userWithoutAccess = User::create(['name' => $this->randomMachineName(), 'roles' => [$role_without_access->id()]]);
     $this->userWithoutAccess->save();
 }
コード例 #29
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     ViewTestData::createTestViews(get_class($this), array('file_test_views'));
     $this->installEntitySchema('file');
     file_put_contents('public://file.png', '');
     File::create(['uri' => 'public://file.png', 'filename' => 'file.png'])->save();
     file_put_contents('public://file.tar', '');
     File::create(['uri' => 'public://file.tar', 'filename' => 'file.tar'])->save();
     file_put_contents('public://file.tar.gz', '');
     File::create(['uri' => 'public://file.tar.gz', 'filename' => 'file.tar.gz'])->save();
     file_put_contents('public://file', '');
     File::create(['uri' => 'public://file', 'filename' => 'file'])->save();
 }
コード例 #30
0
 protected function setUp()
 {
     parent::setUp();
     $this->mockStandardInstall();
     ViewTestData::createTestViews(get_class($this), ['options_test_views']);
     $settings = [];
     $settings['type'] = 'article';
     $settings['field_test_list_string'][]['value'] = $this->fieldValues[0];
     $settings['field_test_list_integer'][]['value'] = 0;
     $node = Node::create($settings);
     $node->save();
     $this->nodes[] = $node;
     $node = $node->createDuplicate();
     $node->save();
     $this->nodes[] = $node;
 }