composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -330,7 +330,9 @@ class DateTimePlusTest extends TestCase {
// Create a date object in the distant past.
// @see https://www.drupal.org/node/2795489#comment-12127088
if (version_compare(PHP_VERSION, '5.6.15', '>=')) {
$dates[] = ['1809-02-12 10:30', 'America/Chicago', '1809-02-12T10:30:00-06:00'];
// Note that this date is after the United States standardized its
// timezones.
$dates[] = ['1883-11-19 10:30', 'America/Chicago', '1883-11-19T10:30:00-06:00'];
}
// Create a date object in the far future.
$dates[] = ['2345-01-02 02:04', 'UTC', '2345-01-02T02:04:00+00:00'];
@ -366,7 +368,9 @@ class DateTimePlusTest extends TestCase {
// Create a date object in the distant past.
// @see https://www.drupal.org/node/2795489#comment-12127088
if (version_compare(PHP_VERSION, '5.6.15', '>=')) {
$dates[] = [['year' => 1809, 'month' => 2, 'day' => 12], 'America/Chicago', '1809-02-12T00:00:00-06:00'];
// Note that this date is after the United States standardized its
// timezones.
$dates[] = [['year' => 1883, 'month' => 11, 'day' => 19], 'America/Chicago', '1883-11-19T00:00:00-06:00'];
}
// Create a date object in the far future.
$dates[] = [['year' => 2345, 'month' => 1, 'day' => 2], 'UTC', '2345-01-02T00:00:00+00:00'];

View file

@ -142,8 +142,6 @@ class PhpTransliterationTest extends TestCase {
// Test strings in some other languages.
// Turkish, provided by drupal.org user Kartagis.
['tr', 'Abayı serdiler bize. Söyleyeceğim yüzlerine. Sanırım hepimiz aynı şeyi düşünüyoruz.', 'Abayi serdiler bize. Soyleyecegim yuzlerine. Sanirim hepimiz ayni seyi dusunuyoruz.'],
// Illegal/unknown unicode.
['en', chr(0xF8) . chr(0x80) . chr(0x80) . chr(0x80) . chr(0x80), '?'],
// Max length.
['de', $two_byte, 'Ae Oe', '?', 5],
];
@ -164,6 +162,60 @@ class PhpTransliterationTest extends TestCase {
$this->assertSame($trunc_output, $transliteration->transliterate($input, 'de', '?', 18), 'Truncating to 18 characters works');
}
/**
* Tests the unknown character replacement.
*
* @param string $langcode
* The language code to test.
* @param string $original
* The original string.
* @param string $expected
* The expected return from PhpTransliteration::transliterate().
* @param string $unknown_character
* The character to substitute for characters in $string without
* transliterated equivalents.
* @param int $max_length
* The maximum length of the string that returns the transliteration.
*
* @dataProvider providerTestTransliterationUnknownCharacter
*/
public function testTransliterationUnknownCharacter($langcode, $original, $expected, $unknown_character = '?', $max_length = NULL) {
$transliteration = new PhpTransliteration();
$actual = $transliteration->transliterate($original, $langcode, $unknown_character, $max_length);
$this->assertSame($expected, $actual);
}
/**
* Provides data for self::testTransliterationUnknownCharacter().
*
* @return array
* An array of arrays, each containing the parameters for
* self::testTransliterationUnknownCharacter().
*/
public function providerTestTransliterationUnknownCharacter() {
return [
// Each test case is (language code, input, output, unknown character, max
// length).
// Illegal/unknown unicode.
['en', chr(0xF8) . chr(0x80) . chr(0x80) . chr(0x80) . chr(0x80), '?????'],
['en', chr(0xF8) . chr(0x80) . chr(0x80) . chr(0x80) . chr(0x80), '-----', '-'],
['en', 'Hel' . chr(0x80) . 'o World', 'Hel?o World'],
['en', 'Hell' . chr(0x80) . ' World', 'Hell? World'],
// Non default replacement.
['en', chr(0x80) . 'ello World', '_ello World', '_'],
// Keep the original question marks.
['en', chr(0xF8) . '?' . chr(0x80), '???'],
['en', chr(0x80) . 'ello ? World?', '_ello ? World?', '_'],
['pl', 'aąeę' . chr(0x80) . 'oółżźz ?', 'aaee?oolzzz ?'],
// Non-US-ASCII replacement.
['en', chr(0x80) . 'ello World?', 'Oello World?', 'Ö'],
['pl', chr(0x80) . 'óóść', 'ooosc', 'ó'],
// Ensure question marks are replaced when max length used.
['en', chr(0x80) . 'ello ? World?', '_ello ?', '_', 7],
];
}
/**
* Tests inclusion is safe.
*

View file

@ -0,0 +1,60 @@
<?php
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Mail;
use PHPUnit\Framework\TestCase;
/**
* Test mail helpers implemented in Mail component.
*
* @group Utility
*
* @coversDefaultClass \Drupal\Component\Utility\Mail
*/
class MailTest extends TestCase {
/**
* Tests RFC-2822 'display-name' formatter.
*
* @dataProvider providerTestDisplayName
* @covers ::formatDisplayName
*/
public function testFormatDisplayName($string, $safe_display_name) {
$this->assertEquals($safe_display_name, Mail::formatDisplayName($string));
}
/**
* Data provider for testFormatDisplayName().
*
* @see testFormatDisplayName()
*
* @return array
* An array containing a string and its 'display-name' safe value.
*/
public function providerTestDisplayName() {
return [
// Simple ASCII characters.
['Test site', 'Test site'],
// ASCII with html entity.
['Test &amp; site', 'Test & site'],
// Non-ASCII characters.
['Tést site', '=?UTF-8?B?VMOpc3Qgc2l0ZQ==?='],
// Non-ASCII with special characters.
['Tést; site', '=?UTF-8?B?VMOpc3Q7IHNpdGU=?='],
// Non-ASCII with html entity.
['T&eacute;st; site', '=?UTF-8?B?VMOpc3Q7IHNpdGU=?='],
// ASCII with special characters.
['Test; site', '"Test; site"'],
// ASCII with special characters as html entity.
['Test &lt; site', '"Test < site"'],
// ASCII with special characters and '\'.
['Test; \ "site"', '"Test; \\\\ \"site\""'],
// String already RFC-2822 compliant.
['"Test; site"', '"Test; site"'],
// String already RFC-2822 compliant.
['"Test; \\\\ \"site\""', '"Test; \\\\ \"site\""'],
];
}
}