Issue #2938799 by claudiu.cristea: Provide the timestamp scalar data type

8.6.x
Nathaniel Catchpole 2018-01-23 16:01:41 +00:00
parent 1d0dce8408
commit e15fce6d02
5 changed files with 76 additions and 0 deletions

View File

@ -28,6 +28,9 @@ email:
integer:
label: 'Integer'
class: '\Drupal\Core\TypedData\Plugin\DataType\IntegerData'
timestamp:
label: 'Timestamp'
class: '\Drupal\Core\TypedData\Plugin\DataType\Timestamp'
float:
label: 'Float'
class: '\Drupal\Core\TypedData\Plugin\DataType\FloatData'

View File

@ -0,0 +1,19 @@
langcode: en
status: true
dependencies:
config:
- field.storage.entity_test.timestamp
id: entity_test.entity_test.timestamp
field_name: timestamp
entity_type: entity_test
bundle: entity_test
label: 'Time stamp'
description: ''
required: false
translatable: false
default_value:
-
value: 1514847537
default_value_callback: ''
settings: { }
field_type: timestamp

View File

@ -0,0 +1,17 @@
langcode: en
status: true
dependencies:
module:
- entity_test
id: node.timestamp
field_name: timestamp
entity_type: entity_test
type: timestamp
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -0,0 +1,9 @@
name: 'Field Timestamp Test'
type: module
description: 'Support module for the Timestamp field item test.'
core: 8.x
package: Testing
version: VERSION
dependencies:
- entity_test
- field

View File

@ -0,0 +1,28 @@
<?php
namespace Drupal\KernelTests\Core\Datetime;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests timestamp schema.
*
* @group Common
*/
class TimestampSchemaTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['entity_test', 'field', 'field_timestamp_test'];
/**
* Tests if the timestamp field schema is validated.
*/
public function testTimestampSchema() {
$this->installConfig(['field_timestamp_test']);
// Make at least an assertion.
$this->assertTrue(TRUE);
}
}