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

@ -223,6 +223,23 @@ Exception {
#file: "%sExceptionCasterTest.php"
#line: 28
}
EODUMP;
$this->assertDumpMatchesFormat($expectedDump, $e, Caster::EXCLUDE_VERBOSE);
}
public function testAnonymous()
{
$e = new \Exception(sprintf('Boo "%s" ba.', \get_class(new class('Foo') extends \Exception {
})));
$expectedDump = <<<'EODUMP'
Exception {
#message: "Boo "Exception@anonymous" ba."
#code: 0
#file: "%sExceptionCasterTest.php"
#line: %d
}
EODUMP;
$this->assertDumpMatchesFormat($expectedDump, $e, Caster::EXCLUDE_VERBOSE);

View file

@ -0,0 +1,299 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @requires extension intl
*/
class IntlCasterTest extends TestCase
{
use VarDumperTestTrait;
public function testMessageFormatter()
{
$var = new \MessageFormatter('en', 'Hello {name}');
$expected = <<<EOTXT
MessageFormatter {
locale: "en"
pattern: "Hello {name}"
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
public function testCastNumberFormatter()
{
$var = new \NumberFormatter('en', \NumberFormatter::DECIMAL);
$expectedLocale = $var->getLocale();
$expectedPattern = $var->getPattern();
$expectedAttribute1 = $var->getAttribute(\NumberFormatter::PARSE_INT_ONLY);
$expectedAttribute2 = $var->getAttribute(\NumberFormatter::GROUPING_USED);
$expectedAttribute3 = $var->getAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN);
$expectedAttribute4 = $var->getAttribute(\NumberFormatter::MAX_INTEGER_DIGITS);
$expectedAttribute5 = $var->getAttribute(\NumberFormatter::MIN_INTEGER_DIGITS);
$expectedAttribute6 = $var->getAttribute(\NumberFormatter::INTEGER_DIGITS);
$expectedAttribute7 = $var->getAttribute(\NumberFormatter::MAX_FRACTION_DIGITS);
$expectedAttribute8 = $var->getAttribute(\NumberFormatter::MIN_FRACTION_DIGITS);
$expectedAttribute9 = $var->getAttribute(\NumberFormatter::FRACTION_DIGITS);
$expectedAttribute10 = $var->getAttribute(\NumberFormatter::MULTIPLIER);
$expectedAttribute11 = $var->getAttribute(\NumberFormatter::GROUPING_SIZE);
$expectedAttribute12 = $var->getAttribute(\NumberFormatter::ROUNDING_MODE);
$expectedAttribute13 = number_format($var->getAttribute(\NumberFormatter::ROUNDING_INCREMENT), 1);
$expectedAttribute14 = $var->getAttribute(\NumberFormatter::FORMAT_WIDTH);
$expectedAttribute15 = $var->getAttribute(\NumberFormatter::PADDING_POSITION);
$expectedAttribute16 = $var->getAttribute(\NumberFormatter::SECONDARY_GROUPING_SIZE);
$expectedAttribute17 = $var->getAttribute(\NumberFormatter::SIGNIFICANT_DIGITS_USED);
$expectedAttribute18 = $var->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS);
$expectedAttribute19 = $var->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS);
$expectedAttribute20 = $var->getAttribute(\NumberFormatter::LENIENT_PARSE);
$expectedTextAttribute1 = $var->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX);
$expectedTextAttribute2 = $var->getTextAttribute(\NumberFormatter::POSITIVE_SUFFIX);
$expectedTextAttribute3 = $var->getTextAttribute(\NumberFormatter::NEGATIVE_PREFIX);
$expectedTextAttribute4 = $var->getTextAttribute(\NumberFormatter::NEGATIVE_SUFFIX);
$expectedTextAttribute5 = $var->getTextAttribute(\NumberFormatter::PADDING_CHARACTER);
$expectedTextAttribute6 = $var->getTextAttribute(\NumberFormatter::CURRENCY_CODE);
$expectedTextAttribute7 = $var->getTextAttribute(\NumberFormatter::DEFAULT_RULESET) ? 'true' : 'false';
$expectedTextAttribute8 = $var->getTextAttribute(\NumberFormatter::PUBLIC_RULESETS) ? 'true' : 'false';
$expectedSymbol1 = $var->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
$expectedSymbol2 = $var->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
$expectedSymbol3 = $var->getSymbol(\NumberFormatter::PATTERN_SEPARATOR_SYMBOL);
$expectedSymbol4 = $var->getSymbol(\NumberFormatter::PERCENT_SYMBOL);
$expectedSymbol5 = $var->getSymbol(\NumberFormatter::ZERO_DIGIT_SYMBOL);
$expectedSymbol6 = $var->getSymbol(\NumberFormatter::DIGIT_SYMBOL);
$expectedSymbol7 = $var->getSymbol(\NumberFormatter::MINUS_SIGN_SYMBOL);
$expectedSymbol8 = $var->getSymbol(\NumberFormatter::PLUS_SIGN_SYMBOL);
$expectedSymbol9 = $var->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
$expectedSymbol10 = $var->getSymbol(\NumberFormatter::INTL_CURRENCY_SYMBOL);
$expectedSymbol11 = $var->getSymbol(\NumberFormatter::MONETARY_SEPARATOR_SYMBOL);
$expectedSymbol12 = $var->getSymbol(\NumberFormatter::EXPONENTIAL_SYMBOL);
$expectedSymbol13 = $var->getSymbol(\NumberFormatter::PERMILL_SYMBOL);
$expectedSymbol14 = $var->getSymbol(\NumberFormatter::PAD_ESCAPE_SYMBOL);
$expectedSymbol15 = $var->getSymbol(\NumberFormatter::INFINITY_SYMBOL);
$expectedSymbol16 = $var->getSymbol(\NumberFormatter::NAN_SYMBOL);
$expectedSymbol17 = $var->getSymbol(\NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL);
$expectedSymbol18 = $var->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL);
$expected = <<<EOTXT
NumberFormatter {
locale: "$expectedLocale"
pattern: "$expectedPattern"
attributes: {
PARSE_INT_ONLY: $expectedAttribute1
GROUPING_USED: $expectedAttribute2
DECIMAL_ALWAYS_SHOWN: $expectedAttribute3
MAX_INTEGER_DIGITS: $expectedAttribute4
MIN_INTEGER_DIGITS: $expectedAttribute5
INTEGER_DIGITS: $expectedAttribute6
MAX_FRACTION_DIGITS: $expectedAttribute7
MIN_FRACTION_DIGITS: $expectedAttribute8
FRACTION_DIGITS: $expectedAttribute9
MULTIPLIER: $expectedAttribute10
GROUPING_SIZE: $expectedAttribute11
ROUNDING_MODE: $expectedAttribute12
ROUNDING_INCREMENT: $expectedAttribute13
FORMAT_WIDTH: $expectedAttribute14
PADDING_POSITION: $expectedAttribute15
SECONDARY_GROUPING_SIZE: $expectedAttribute16
SIGNIFICANT_DIGITS_USED: $expectedAttribute17
MIN_SIGNIFICANT_DIGITS: $expectedAttribute18
MAX_SIGNIFICANT_DIGITS: $expectedAttribute19
LENIENT_PARSE: $expectedAttribute20
}
text_attributes: {
POSITIVE_PREFIX: "$expectedTextAttribute1"
POSITIVE_SUFFIX: "$expectedTextAttribute2"
NEGATIVE_PREFIX: "$expectedTextAttribute3"
NEGATIVE_SUFFIX: "$expectedTextAttribute4"
PADDING_CHARACTER: "$expectedTextAttribute5"
CURRENCY_CODE: "$expectedTextAttribute6"
DEFAULT_RULESET: $expectedTextAttribute7
PUBLIC_RULESETS: $expectedTextAttribute8
}
symbols: {
DECIMAL_SEPARATOR_SYMBOL: "$expectedSymbol1"
GROUPING_SEPARATOR_SYMBOL: "$expectedSymbol2"
PATTERN_SEPARATOR_SYMBOL: "$expectedSymbol3"
PERCENT_SYMBOL: "$expectedSymbol4"
ZERO_DIGIT_SYMBOL: "$expectedSymbol5"
DIGIT_SYMBOL: "$expectedSymbol6"
MINUS_SIGN_SYMBOL: "$expectedSymbol7"
PLUS_SIGN_SYMBOL: "$expectedSymbol8"
CURRENCY_SYMBOL: "$expectedSymbol9"
INTL_CURRENCY_SYMBOL: "$expectedSymbol10"
MONETARY_SEPARATOR_SYMBOL: "$expectedSymbol11"
EXPONENTIAL_SYMBOL: "$expectedSymbol12"
PERMILL_SYMBOL: "$expectedSymbol13"
PAD_ESCAPE_SYMBOL: "$expectedSymbol14"
INFINITY_SYMBOL: "$expectedSymbol15"
NAN_SYMBOL: "$expectedSymbol16"
SIGNIFICANT_DIGIT_SYMBOL: "$expectedSymbol17"
MONETARY_GROUPING_SEPARATOR_SYMBOL: "$expectedSymbol18"
}
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
public function testCastIntlTimeZoneWithDST()
{
$var = \IntlTimeZone::createTimeZone('America/Los_Angeles');
$expectedDisplayName = $var->getDisplayName();
$expectedDSTSavings = $var->getDSTSavings();
$expectedID = $var->getID();
$expectedRawOffset = $var->getRawOffset();
$expected = <<<EOTXT
IntlTimeZone {
display_name: "$expectedDisplayName"
id: "$expectedID"
raw_offset: $expectedRawOffset
dst_savings: $expectedDSTSavings
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
public function testCastIntlTimeZoneWithoutDST()
{
$var = \IntlTimeZone::createTimeZone('Asia/Bangkok');
$expectedDisplayName = $var->getDisplayName();
$expectedID = $var->getID();
$expectedRawOffset = $var->getRawOffset();
$expected = <<<EOTXT
IntlTimeZone {
display_name: "$expectedDisplayName"
id: "$expectedID"
raw_offset: $expectedRawOffset
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
public function testCastIntlCalendar()
{
$var = \IntlCalendar::createInstance('America/Los_Angeles', 'en');
$expectedType = $var->getType();
$expectedFirstDayOfWeek = $var->getFirstDayOfWeek();
$expectedMinimalDaysInFirstWeek = $var->getMinimalDaysInFirstWeek();
$expectedRepeatedWallTimeOption = $var->getRepeatedWallTimeOption();
$expectedSkippedWallTimeOption = $var->getSkippedWallTimeOption();
$expectedTime = $var->getTime().'.0';
$expectedInDaylightTime = $var->inDaylightTime() ? 'true' : 'false';
$expectedIsLenient = $var->isLenient() ? 'true' : 'false';
$expectedTimeZone = $var->getTimeZone();
$expectedTimeZoneDisplayName = $expectedTimeZone->getDisplayName();
$expectedTimeZoneID = $expectedTimeZone->getID();
$expectedTimeZoneRawOffset = $expectedTimeZone->getRawOffset();
$expectedTimeZoneDSTSavings = $expectedTimeZone->getDSTSavings();
$expected = <<<EOTXT
IntlGregorianCalendar {
type: "$expectedType"
first_day_of_week: $expectedFirstDayOfWeek
minimal_days_in_first_week: $expectedMinimalDaysInFirstWeek
repeated_wall_time_option: $expectedRepeatedWallTimeOption
skipped_wall_time_option: $expectedSkippedWallTimeOption
time: $expectedTime
in_daylight_time: $expectedInDaylightTime
is_lenient: $expectedIsLenient
time_zone: IntlTimeZone {
display_name: "$expectedTimeZoneDisplayName"
id: "$expectedTimeZoneID"
raw_offset: $expectedTimeZoneRawOffset
dst_savings: $expectedTimeZoneDSTSavings
}
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
public function testCastDateFormatter()
{
$var = new \IntlDateFormatter('en', \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::TRADITIONAL);
$expectedLocale = $var->getLocale();
$expectedPattern = $var->getPattern();
$expectedCalendar = $var->getCalendar();
$expectedTimeZoneId = $var->getTimeZoneId();
$expectedTimeType = $var->getTimeType();
$expectedDateType = $var->getDateType();
$expectedCalendarObject = $var->getCalendarObject();
$expectedCalendarObjectType = $expectedCalendarObject->getType();
$expectedCalendarObjectFirstDayOfWeek = $expectedCalendarObject->getFirstDayOfWeek();
$expectedCalendarObjectMinimalDaysInFirstWeek = $expectedCalendarObject->getMinimalDaysInFirstWeek();
$expectedCalendarObjectRepeatedWallTimeOption = $expectedCalendarObject->getRepeatedWallTimeOption();
$expectedCalendarObjectSkippedWallTimeOption = $expectedCalendarObject->getSkippedWallTimeOption();
$expectedCalendarObjectTime = $expectedCalendarObject->getTime().'.0';
$expectedCalendarObjectInDaylightTime = $expectedCalendarObject->inDaylightTime() ? 'true' : 'false';
$expectedCalendarObjectIsLenient = $expectedCalendarObject->isLenient() ? 'true' : 'false';
$expectedCalendarObjectTimeZone = $expectedCalendarObject->getTimeZone();
$expectedCalendarObjectTimeZoneDisplayName = $expectedCalendarObjectTimeZone->getDisplayName();
$expectedCalendarObjectTimeZoneID = $expectedCalendarObjectTimeZone->getID();
$expectedCalendarObjectTimeZoneRawOffset = $expectedCalendarObjectTimeZone->getRawOffset();
$expectedCalendarObjectTimeZoneDSTSavings = $expectedCalendarObjectTimeZone->getDSTSavings();
$expectedTimeZone = $var->getTimeZone();
$expectedTimeZoneDisplayName = $expectedTimeZone->getDisplayName();
$expectedTimeZoneID = $expectedTimeZone->getID();
$expectedTimeZoneRawOffset = $expectedTimeZone->getRawOffset();
$expectedTimeZoneDSTSavings = $expectedTimeZone->getDSTSavings();
$expected = <<<EOTXT
IntlDateFormatter {
locale: "$expectedLocale"
pattern: "$expectedPattern"
calendar: $expectedCalendar
time_zone_id: "$expectedTimeZoneId"
time_type: $expectedTimeType
date_type: $expectedDateType
calendar_object: IntlGregorianCalendar {
type: "$expectedCalendarObjectType"
first_day_of_week: $expectedCalendarObjectFirstDayOfWeek
minimal_days_in_first_week: $expectedCalendarObjectMinimalDaysInFirstWeek
repeated_wall_time_option: $expectedCalendarObjectRepeatedWallTimeOption
skipped_wall_time_option: $expectedCalendarObjectSkippedWallTimeOption
time: $expectedCalendarObjectTime
in_daylight_time: $expectedCalendarObjectInDaylightTime
is_lenient: $expectedCalendarObjectIsLenient
time_zone: IntlTimeZone {
display_name: "$expectedCalendarObjectTimeZoneDisplayName"
id: "$expectedCalendarObjectTimeZoneID"
raw_offset: $expectedCalendarObjectTimeZoneRawOffset
dst_savings: $expectedCalendarObjectTimeZoneDSTSavings
}
}
time_zone: IntlTimeZone {
display_name: "$expectedTimeZoneDisplayName"
id: "$expectedTimeZoneID"
raw_offset: $expectedTimeZoneRawOffset
dst_savings: $expectedTimeZoneDSTSavings
}
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
}

View file

@ -0,0 +1,93 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Jan Schädlich <jan.schaedlich@sensiolabs.de>
*/
class MemcachedCasterTest extends TestCase
{
use VarDumperTestTrait;
public function testCastMemcachedWithDefaultOptions()
{
if (!class_exists('Memcached')) {
$this->markTestSkipped('Memcached not available');
}
$var = new \Memcached();
$var->addServer('127.0.0.1', 11211);
$var->addServer('127.0.0.2', 11212);
$expected = <<<EOTXT
Memcached {
servers: array:2 [
0 => array:3 [
"host" => "127.0.0.1"
"port" => 11211
"type" => "TCP"
]
1 => array:3 [
"host" => "127.0.0.2"
"port" => 11212
"type" => "TCP"
]
]
options: {}
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
public function testCastMemcachedWithCustomOptions()
{
if (!class_exists('Memcached')) {
$this->markTestSkipped('Memcached not available');
}
$var = new \Memcached();
$var->addServer('127.0.0.1', 11211);
$var->addServer('127.0.0.2', 11212);
// set a subset of non default options to test boolean, string and integer output
$var->setOption(\Memcached::OPT_COMPRESSION, false);
$var->setOption(\Memcached::OPT_PREFIX_KEY, 'pre');
$var->setOption(\Memcached::OPT_DISTRIBUTION, \Memcached::DISTRIBUTION_CONSISTENT);
$expected = <<<'EOTXT'
Memcached {
servers: array:2 [
0 => array:3 [
"host" => "127.0.0.1"
"port" => 11211
"type" => "TCP"
]
1 => array:3 [
"host" => "127.0.0.2"
"port" => 11212
"type" => "TCP"
]
]
options: {
OPT_COMPRESSION: false
OPT_PREFIX_KEY: "pre"
OPT_DISTRIBUTION: 1
}
}
EOTXT;
$this->assertDumpEquals($expected, $var);
}
}

View file

@ -49,11 +49,15 @@ Redis {%A
host: "127.0.0.1"
port: 6379
auth: null
mode: ATOMIC
dbNum: 0
timeout: 0.0
lastError: null
persistentId: null
options: {
TCP_KEEPALIVE: 0
READ_TIMEOUT: 0.0
COMPRESSION: NONE
SERIALIZER: NONE
PREFIX: null
SCAN: NORETRY

View file

@ -68,14 +68,14 @@ EOTXT
$var = function ($x) use ($a, &$b) {};
$this->assertDumpMatchesFormat(
<<<EOTXT
Closure {
<<<'EOTXT'
Closure($x) {
%Aparameters: {
\$x: {}
$x: {}
}
use: {
\$a: 123
\$b: & 123
$a: 123
$b: & 123
}
file: "%sReflectionCasterTest.php"
line: "68 to 68"
@ -85,18 +85,39 @@ EOTXT
);
}
public function testFromCallableClosureCaster()
{
if (\defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('Not for HHVM.');
}
$var = array(
(new \ReflectionMethod($this, __FUNCTION__))->getClosure($this),
(new \ReflectionMethod(__CLASS__, 'tearDownAfterClass'))->getClosure(),
);
$this->assertDumpMatchesFormat(
<<<EOTXT
array:2 [
0 => Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest::testFromCallableClosureCaster() {
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { }
file: "%sReflectionCasterTest.php"
line: "%d to %d"
}
1 => %sTestCase::tearDownAfterClass() {
file: "%sTestCase.php"
line: "%d to %d"
}
]
EOTXT
, $var
);
}
public function testClosureCasterExcludingVerbosity()
{
$var = function () {};
$var = function &($a = 5) {};
$expectedDump = <<<EOTXT
Closure {
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { }
}
EOTXT;
$this->assertDumpEquals($expectedDump, $var, Caster::EXCLUDE_VERBOSE);
$this->assertDumpEquals('Closure&($a = 5) { …6}', $var, Caster::EXCLUDE_VERBOSE);
}
public function testReflectionParameter()
@ -140,7 +161,7 @@ EOTXT
$this->assertDumpMatchesFormat(
<<<EOTXT
Closure {
Closure(): int {
returnType: "int"
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { }

View file

@ -35,7 +35,7 @@ SplFileInfo {
aTime: %s-%s-%d %d:%d:%d
mTime: %s-%s-%d %d:%d:%d
cTime: %s-%s-%d %d:%d:%d
inode: %d
inode: %i
size: %d
perms: 0%d
owner: %d
@ -85,7 +85,7 @@ SplFileObject {
aTime: %s-%s-%d %d:%d:%d
mTime: %s-%s-%d %d:%d:%d
cTime: %s-%s-%d %d:%d:%d
inode: %d
inode: %i
size: %d
perms: 0%d
owner: %d
@ -105,7 +105,7 @@ SplFileObject {
maxLineLen: 0
fstat: array:26 [
"dev" => %d
"ino" => %d
"ino" => %i
"nlink" => %d
"rdev" => 0
"blksize" => %i

View file

@ -141,7 +141,7 @@ EODUMP;
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10" rel="noopener noreferrer"><span class=sf-dump-str title="39 characters">hello(?stdClass $a, stdClass $b = null)</span></a>"
</samp>]
</bar>
EODUMP;
@ -185,6 +185,27 @@ EODUMP;
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:5" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
</samp>]
</bar>
EODUMP;
$this->assertStringMatchesFormat($expectedDump, $dump);
}
public function testClassStubWithAnonymousClass()
{
$var = array(new ClassStub(\get_class(new class() extends \Exception {
})));
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
<span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:195" rel="noopener noreferrer"><span class=sf-dump-str title="19 characters">Exception@anonymous</span></a>"
</samp>]
</bar>
EODUMP;
$this->assertStringMatchesFormat($expectedDump, $dump);