Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\datetime\Tests\Views\ArgumentDateTimeTest.
*/
namespace Drupal\datetime\Tests\Views;
use Drupal\views\Views;
@ -138,4 +133,71 @@ class ArgumentDateTimeTest extends DateTimeHandlerTestBase {
$view->destroy();
}
/**
* Test week WW argument.
*/
public function testDatetimeArgumentWeek() {
$view = Views::getView('test_argument_datetime');
// The 'embed_4' display has WW argument.
$view->setDisplay('embed_4');
$this->executeView($view, ['41']);
$expected = [];
$expected[] = ['nid' => $this->nodes[0]->id()];
$expected[] = ['nid' => $this->nodes[1]->id()];
$this->assertIdenticalResultset($view, $expected, $this->map);
$view->destroy();
$view->setDisplay('embed_4');
$this->executeView($view, ['01']);
$expected = [];
$expected[] = ['nid' => $this->nodes[2]->id()];
$this->assertIdenticalResultset($view, $expected, $this->map);
$view->destroy();
}
/**
* Test full_date CCYYMMDD argument.
*/
public function testDatetimeArgumentFullDate() {
$view = Views::getView('test_argument_datetime');
// The 'embed_5' display has CCYYMMDD argument.
$view->setDisplay('embed_5');
$this->executeView($view, ['20001010']);
$expected = [];
$expected[] = ['nid' => $this->nodes[0]->id()];
$this->assertIdenticalResultset($view, $expected, $this->map);
$view->destroy();
$view->setDisplay('embed_5');
$this->executeView($view, ['20020101']);
$expected = [];
$expected[] = ['nid' => $this->nodes[2]->id()];
$this->assertIdenticalResultset($view, $expected, $this->map);
$view->destroy();
}
/**
* Test year_month CCYYMM argument.
*/
public function testDatetimeArgumentYearMonth() {
$view = Views::getView('test_argument_datetime');
// The 'embed_6' display has CCYYMM argument.
$view->setDisplay('embed_6');
$this->executeView($view, ['200010']);
$expected = [];
$expected[] = ['nid' => $this->nodes[0]->id()];
$this->assertIdenticalResultset($view, $expected, $this->map);
$view->destroy();
$view->setDisplay('embed_6');
$this->executeView($view, ['200201']);
$expected = [];
$expected[] = ['nid' => $this->nodes[2]->id()];
$this->assertIdenticalResultset($view, $expected, $this->map);
$view->destroy();
}
}

View file

@ -1,15 +1,13 @@
<?php
/**
* @file
* Contains \Drupal\datetime\Tests\Views\DateTimeHandlerTestBase.
*/
namespace Drupal\datetime\Tests\Views;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\field\Entity\FieldConfig;
use Drupal\node\Entity\NodeType;
use Drupal\views\Tests\Handler\HandlerTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Base class for testing datetime handlers.
@ -44,19 +42,19 @@ abstract class DateTimeHandlerTestBase extends HandlerTestBase {
parent::setUp();
// Add a date field to page nodes.
$node_type = entity_create('node_type', [
$node_type = NodeType::create([
'type' => 'page',
'name' => 'page'
]);
$node_type->save();
$fieldStorage = entity_create('field_storage_config', [
$fieldStorage = FieldStorageConfig::create([
'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 = FieldConfig::create([
'field_storage' => $fieldStorage,
'bundle' => 'page',
'required' => TRUE,

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\datetime\Tests\Views\FilterDateTest.
*/
namespace Drupal\datetime\Tests\Views;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\field\Entity\FieldStorageConfig;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\datetime\Tests\Views\FilterDateTimeTest.
*/
namespace Drupal\datetime\Tests\Views;
use Drupal\views\Views;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\datetime\Tests\Views\SortDateTimeTest.
*/
namespace Drupal\datetime\Tests\Views;
use Drupal\views\Views;