Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2
This commit is contained in:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
@ -116,4 +116,5 @@ class ZfExtensionManagerSfContainerTest extends UnitTestCase {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,42 @@ class DateTimePlusTest extends UnitTestCase {
|
|||
$this->assertEquals($expected, $value, sprintf("Test new DateTimePlus(%s, %s): should be %s, found %s.", $input, $timezone, $expected, $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test date diffs.
|
||||
*
|
||||
* @param mixed $input1
|
||||
* A DateTimePlus object.
|
||||
* @param mixed $input2
|
||||
* Date argument for DateTimePlus::diff method.
|
||||
* @param bool $absolute
|
||||
* Absolute flag for DateTimePlus::diff method.
|
||||
* @param \DateInterval $expected
|
||||
* The expected result of the DateTimePlus::diff operation.
|
||||
*
|
||||
* @dataProvider providerTestDateDiff
|
||||
*/
|
||||
public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected) {
|
||||
$interval = $input1->diff($input2, $absolute);
|
||||
$this->assertEquals($interval, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test date diff exception caused by invalid input.
|
||||
*
|
||||
* @param mixed $input1
|
||||
* A DateTimePlus object.
|
||||
* @param mixed $input2
|
||||
* Date argument for DateTimePlus::diff method.
|
||||
* @param bool $absolute
|
||||
* Absolute flag for DateTimePlus::diff method.
|
||||
*
|
||||
* @dataProvider providerTestInvalidDateDiff
|
||||
*/
|
||||
public function testInvalidDateDiff($input1, $input2, $absolute) {
|
||||
$this->setExpectedException(\BadMethodCallException::class, 'Method Drupal\Component\Datetime\DateTimePlus::diff expects parameter 1 to be a \DateTime or \Drupal\Component\Datetime\DateTimePlus object');
|
||||
$interval = $input1->diff($input2, $absolute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating dates from invalid array input.
|
||||
*
|
||||
|
@ -250,7 +286,7 @@ class DateTimePlusTest extends UnitTestCase {
|
|||
* An array of arrays, each containing the input parameters for
|
||||
* DateTimePlusTest::testDates().
|
||||
*
|
||||
* @see DateTimePlusTest::testDates().
|
||||
* @see DateTimePlusTest::testDates()
|
||||
*/
|
||||
public function providerTestDates() {
|
||||
return array(
|
||||
|
@ -277,7 +313,7 @@ class DateTimePlusTest extends UnitTestCase {
|
|||
* An array of arrays, each containing the input parameters for
|
||||
* DateTimePlusTest::testDates().
|
||||
*
|
||||
* @see DateTimePlusTest::testDates().
|
||||
* @see DateTimePlusTest::testDates()
|
||||
*/
|
||||
public function providerTestDateArrays() {
|
||||
return array(
|
||||
|
@ -528,4 +564,106 @@ class DateTimePlusTest extends UnitTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data for date tests.
|
||||
*
|
||||
* @return array
|
||||
* An array of arrays, each containing the input parameters for
|
||||
* DateTimePlusTest::testDateDiff().
|
||||
*
|
||||
* @see DateTimePlusTest::testDateDiff()
|
||||
*/
|
||||
public function providerTestDateDiff() {
|
||||
|
||||
$empty_interval = new \DateInterval('PT0S');
|
||||
|
||||
$positive_19_hours = new \DateInterval('PT19H');
|
||||
|
||||
$positive_18_hours = new \DateInterval('PT18H');
|
||||
|
||||
$positive_1_hour = new \DateInterval('PT1H');
|
||||
|
||||
$negative_1_hour = new \DateInterval('PT1H');
|
||||
$negative_1_hour->invert = 1;
|
||||
|
||||
return array(
|
||||
// There should be a 19 hour time interval between
|
||||
// new years in Sydney and new years in LA in year 2000.
|
||||
array(
|
||||
'input2' => DateTimePlus::createFromFormat('Y-m-d H:i:s', '2000-01-01 00:00:00', new \DateTimeZone('Australia/Sydney')),
|
||||
'input1' => DateTimePlus::createFromFormat('Y-m-d H:i:s', '2000-01-01 00:00:00', new \DateTimeZone('America/Los_Angeles')),
|
||||
'absolute' => FALSE,
|
||||
'expected' => $positive_19_hours,
|
||||
),
|
||||
// In 1970 Sydney did not observe daylight savings time
|
||||
// So there is only a 18 hour time interval.
|
||||
array(
|
||||
'input2' => DateTimePlus::createFromFormat('Y-m-d H:i:s', '1970-01-01 00:00:00', new \DateTimeZone('Australia/Sydney')),
|
||||
'input1' => DateTimePlus::createFromFormat('Y-m-d H:i:s', '1970-01-01 00:00:00', new \DateTimeZone('America/Los_Angeles')),
|
||||
'absolute' => FALSE,
|
||||
'expected' => $positive_18_hours,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600, new \DateTimeZone('America/Los_Angeles')),
|
||||
'input2' => DateTimePlus::createFromFormat('U', 0, new \DateTimeZone('UTC')),
|
||||
'absolute' => FALSE,
|
||||
'expected' => $negative_1_hour,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600),
|
||||
'input2' => DateTimePlus::createFromFormat('U', 0),
|
||||
'absolute' => FALSE,
|
||||
'expected' => $negative_1_hour,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600),
|
||||
'input2' => \DateTime::createFromFormat('U', 0),
|
||||
'absolute' => FALSE,
|
||||
'expected' => $negative_1_hour,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600),
|
||||
'input2' => DateTimePlus::createFromFormat('U', 0),
|
||||
'absolute' => TRUE,
|
||||
'expected' => $positive_1_hour,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600),
|
||||
'input2' => \DateTime::createFromFormat('U', 0),
|
||||
'absolute' => TRUE,
|
||||
'expected' => $positive_1_hour,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 0),
|
||||
'input2' => DateTimePlus::createFromFormat('U', 0),
|
||||
'absolute' => FALSE,
|
||||
'expected' => $empty_interval,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides data for date tests.
|
||||
*
|
||||
* @return array
|
||||
* An array of arrays, each containing the input parameters for
|
||||
* DateTimePlusTest::testInvalidDateDiff().
|
||||
*
|
||||
* @see DateTimePlusTest::testInvalidDateDiff()
|
||||
*/
|
||||
public function providerTestInvalidDateDiff() {
|
||||
return array(
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600),
|
||||
'input2' => '1970-01-01 00:00:00',
|
||||
'absolute' => FALSE,
|
||||
),
|
||||
array(
|
||||
'input1' => DateTimePlus::createFromFormat('U', 3600),
|
||||
'input2' => NULL,
|
||||
'absolute' => FALSE,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -442,7 +442,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
|
|||
public function testGetForInstantiationWithVariousArgumentLengths() {
|
||||
$args = array();
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$instantiation_service = $this->container->get('service_test_instantiation_'. $i);
|
||||
$instantiation_service = $this->container->get('service_test_instantiation_' . $i);
|
||||
$this->assertEquals($args, $instantiation_service->getArguments());
|
||||
$args[] = 'arg_' . $i;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
namespace Drupal\Tests\Component\EventDispatcher;
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ class StubReflectionFactory extends ReflectionFactory {
|
|||
// Return the class name from the plugin definition.
|
||||
return $plugin_definition[$plugin_id]['class'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -184,4 +184,5 @@ class PhpTransliterationTest extends UnitTestCase {
|
|||
$transliterated = $transliteration->transliterate(chr(0xC2) . chr(0x82), '../index');
|
||||
$this->assertSame($transliterated, 'safe');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ class ArgumentsResolverTest extends UnitTestCase {
|
|||
class TestClass {
|
||||
public function access($foo) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -320,4 +320,5 @@ class HtmlTest extends UnitTestCase {
|
|||
$result = Html::serialize($document);
|
||||
$this->assertSame('', $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -163,4 +163,5 @@ class RandomTest extends UnitTestCase {
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -229,4 +229,5 @@ class SafeMarkupTestString {
|
|||
*/
|
||||
class SafeMarkupTestMarkup implements MarkupInterface {
|
||||
use MarkupTrait;
|
||||
|
||||
}
|
||||
|
|
|
@ -370,7 +370,7 @@ class UrlHelperTest extends UnitTestCase {
|
|||
array(json_decode('"\u00AD"') . "//www.example.com", TRUE),
|
||||
array(json_decode('"\u200E"') . "//www.example.com", TRUE),
|
||||
array(json_decode('"\uE0020"') . "//www.example.com", TRUE),
|
||||
array(json_decode('"\uE000"') . "//www.example.com", TRUE),
|
||||
array(json_decode('"\uE000"') . "//www.example.com", TRUE),
|
||||
// Backslashes should be normalized to forward.
|
||||
array('\\\\example.com', TRUE),
|
||||
// Local URLs.
|
||||
|
@ -584,4 +584,5 @@ class UrlHelperTest extends UnitTestCase {
|
|||
array('http://', 'http://example.com/foo'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,4 +93,5 @@ class UuidTest extends UnitTestCase {
|
|||
array('0ab26e6b-f074-4e44-9daf-1205fa0e9761f', FALSE, 'Invalid length was validated'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue