public function DateTimeHandlerTestBase::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php \Drupal\datetime\Tests\Views\DateTimeHandlerTestBase::setUp()
Sets up a Drupal site for running functional and integration tests.
Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.
Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.
After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.
Overrides ViewTestBase::setUp
4 calls to DateTimeHandlerTestBase::setUp()
- ArgumentDateTimeTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ ArgumentDateTimeTest.php - Sets up a Drupal site for running functional and integration tests.
- FilterDateTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ FilterDateTest.php - Create nodes with relative dates of yesterday, today, and tomorrow.
- FilterDateTimeTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ FilterDateTimeTest.php - Sets up a Drupal site for running functional and integration tests.
- SortDateTimeTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ SortDateTimeTest.php - Sets up a Drupal site for running functional and integration tests.
4 methods override DateTimeHandlerTestBase::setUp()
- ArgumentDateTimeTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ ArgumentDateTimeTest.php - Sets up a Drupal site for running functional and integration tests.
- FilterDateTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ FilterDateTest.php - Create nodes with relative dates of yesterday, today, and tomorrow.
- FilterDateTimeTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ FilterDateTimeTest.php - Sets up a Drupal site for running functional and integration tests.
- SortDateTimeTest::setUp in core/
modules/ datetime/ src/ Tests/ Views/ SortDateTimeTest.php - Sets up a Drupal site for running functional and integration tests.
File
- core/
modules/ datetime/ src/ Tests/ Views/ DateTimeHandlerTestBase.php, line 43 - Contains \Drupal\datetime\Tests\Views\DateTimeHandlerTestBase.
Class
- DateTimeHandlerTestBase
- Base class for testing datetime handlers.
Namespace
Drupal\datetime\Tests\ViewsCode
public function setUp() {
parent::setUp();
// Add a date field to page nodes.
$node_type = entity_create('node_type', [
'type' => 'page',
'name' => 'page',
]);
$node_type
->save();
$fieldStorage = entity_create('field_storage_config', [
'field_name' => static::$field_name,
'entity_type' => 'node',
'type' => 'datetime',
'settings' => [
'datetime_type' => DateTimeItem::DATETIME_TYPE_DATETIME,
],
]);
$fieldStorage
->save();
$field = entity_create('field_config', [
'field_storage' => $fieldStorage,
'bundle' => 'page',
'required' => TRUE,
]);
$field
->save();
// Views needs to be aware of the new field.
$this->container
->get('views.views_data')
->clear();
// Set column map.
$this->map = [
'nid' => 'nid',
];
// Load test views.
ViewTestData::createTestViews(get_class($this), [
'datetime_test',
]);
}