Added Laravel project
This commit is contained in:
181
Laravel/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php
vendored
Normal file
181
Laravel/vendor/symfony/var-dumper/Tests/Caster/CasterTest.php
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
<?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\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
private $referenceArray = array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
'public' => 'pub',
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
"\0*\0protected" => 'prot',
|
||||
"\0Foo\0private" => 'priv',
|
||||
);
|
||||
|
||||
/**
|
||||
* @dataProvider provideFilter
|
||||
*/
|
||||
public function testFilter($filter, $expectedDiff, $listedProperties = null)
|
||||
{
|
||||
if (null === $listedProperties) {
|
||||
$filteredArray = Caster::filter($this->referenceArray, $filter);
|
||||
} else {
|
||||
$filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties);
|
||||
}
|
||||
|
||||
$this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray));
|
||||
}
|
||||
|
||||
public function provideFilter()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
0,
|
||||
array(),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_PUBLIC,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
'public' => 'pub',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NULL,
|
||||
array(
|
||||
'null' => null,
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_EMPTY,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VIRTUAL,
|
||||
array(
|
||||
"\0~\0virtual" => 'virt',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_DYNAMIC,
|
||||
array(
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_PROTECTED,
|
||||
array(
|
||||
"\0*\0protected" => 'prot',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_PRIVATE,
|
||||
array(
|
||||
"\0Foo\0private" => 'priv',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VERBOSE,
|
||||
array(
|
||||
'public' => 'pub',
|
||||
"\0*\0protected" => 'prot',
|
||||
),
|
||||
array('public', "\0*\0protected"),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NOT_IMPORTANT,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
"\0Foo\0private" => 'priv',
|
||||
),
|
||||
array('public', "\0*\0protected"),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC,
|
||||
array(
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE,
|
||||
$this->referenceArray,
|
||||
array('public', "\0*\0protected"),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
"\0*\0protected" => 'prot',
|
||||
"\0Foo\0private" => 'priv',
|
||||
),
|
||||
array('public', 'empty'),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT,
|
||||
array(
|
||||
'empty' => false,
|
||||
),
|
||||
array('public', 'empty'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testAnonymousClass()
|
||||
{
|
||||
$c = eval('return new class extends stdClass { private $foo = "foo"; };');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
stdClass@anonymous {
|
||||
-foo: "foo"
|
||||
}
|
||||
EOTXT
|
||||
, $c
|
||||
);
|
||||
|
||||
$c = eval('return new class { private $foo = "foo"; };');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
@anonymous {
|
||||
-foo: "foo"
|
||||
}
|
||||
EOTXT
|
||||
, $c
|
||||
);
|
||||
}
|
||||
}
|
225
Laravel/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
vendored
Normal file
225
Laravel/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
<?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\Caster\ExceptionCaster;
|
||||
use Symfony\Component\VarDumper\Caster\FrameStub;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
class ExceptionCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
private function getTestException($msg, &$ref = null)
|
||||
{
|
||||
return new \Exception(''.$msg);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
ExceptionCaster::$srcContext = 1;
|
||||
ExceptionCaster::$traceArgs = true;
|
||||
}
|
||||
|
||||
public function testDefaultSettings()
|
||||
{
|
||||
$ref = array('foo');
|
||||
$e = $this->getTestException('foo', $ref);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "foo"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 27
|
||||
trace: {
|
||||
%sExceptionCasterTest.php:27: {
|
||||
: {
|
||||
: return new \Exception(''.$msg);
|
||||
: }
|
||||
}
|
||||
%sExceptionCasterTest.php:%d: {
|
||||
: $ref = array('foo');
|
||||
: $e = $this->getTestException('foo', $ref);
|
||||
:
|
||||
arguments: {
|
||||
$msg: "foo"
|
||||
&$ref: array:1 [ …1]
|
||||
}
|
||||
}
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e);
|
||||
$this->assertSame(array('foo'), $ref);
|
||||
}
|
||||
|
||||
public function testSeek()
|
||||
{
|
||||
$e = $this->getTestException(2);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
{
|
||||
%sExceptionCasterTest.php:27: {
|
||||
: {
|
||||
: return new \Exception(''.$msg);
|
||||
: }
|
||||
}
|
||||
%sExceptionCasterTest.php:%d: {
|
||||
: {
|
||||
: $e = $this->getTestException(2);
|
||||
:
|
||||
arguments: {
|
||||
$msg: 2
|
||||
}
|
||||
}
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $this->getDump($e, 'trace'));
|
||||
}
|
||||
|
||||
public function testNoArgs()
|
||||
{
|
||||
$e = $this->getTestException(1);
|
||||
ExceptionCaster::$traceArgs = false;
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "1"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 27
|
||||
trace: {
|
||||
%sExceptionCasterTest.php:27: {
|
||||
: {
|
||||
: return new \Exception(''.$msg);
|
||||
: }
|
||||
}
|
||||
%sExceptionCasterTest.php:%d: {
|
||||
: {
|
||||
: $e = $this->getTestException(1);
|
||||
: ExceptionCaster::$traceArgs = false;
|
||||
}
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e);
|
||||
}
|
||||
|
||||
public function testNoSrcContext()
|
||||
{
|
||||
$e = $this->getTestException(1);
|
||||
ExceptionCaster::$srcContext = -1;
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "1"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 27
|
||||
trace: {
|
||||
%sExceptionCasterTest.php: 27
|
||||
%sExceptionCasterTest.php: %d
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e);
|
||||
}
|
||||
|
||||
public function testHtmlDump()
|
||||
{
|
||||
$e = $this->getTestException(1);
|
||||
ExceptionCaster::$srcContext = -1;
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$cloner->setMaxItems(1);
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dump = $dumper->dump($cloner->cloneVar($e)->withRefHandles(false), true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>Exception</span> {<samp>
|
||||
#<span class=sf-dump-protected title="Protected property">message</span>: "<span class=sf-dump-str>1</span>"
|
||||
#<span class=sf-dump-protected title="Protected property">code</span>: <span class=sf-dump-num>0</span>
|
||||
#<span class=sf-dump-protected title="Protected property">file</span>: "<span class=sf-dump-str title="%sExceptionCasterTest.php
|
||||
%d characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eCaster%eExceptionCasterTest.php</span>"
|
||||
#<span class=sf-dump-protected title="Protected property">line</span>: <span class=sf-dump-num>27</span>
|
||||
<span class=sf-dump-meta>trace</span>: {<samp>
|
||||
<span class=sf-dump-meta title="%sExceptionCasterTest.php
|
||||
Stack level %d."><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eCaster%eExceptionCasterTest.php</span>: <span class=sf-dump-num>27</span>
|
||||
…%d
|
||||
</samp>}
|
||||
</samp>}
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires function Twig\Template::getSourceContext
|
||||
*/
|
||||
public function testFrameWithTwig()
|
||||
{
|
||||
require_once dirname(__DIR__).'/Fixtures/Twig.php';
|
||||
|
||||
$f = array(
|
||||
new FrameStub(array(
|
||||
'file' => dirname(__DIR__).'/Fixtures/Twig.php',
|
||||
'line' => 20,
|
||||
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
|
||||
)),
|
||||
new FrameStub(array(
|
||||
'file' => dirname(__DIR__).'/Fixtures/Twig.php',
|
||||
'line' => 21,
|
||||
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
|
||||
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__),
|
||||
)),
|
||||
);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
0 => {
|
||||
class: "__TwigTemplate_VarDumperFixture_u75a09"
|
||||
src: {
|
||||
%sTwig.php:1: {
|
||||
:
|
||||
: foo bar
|
||||
: twig source
|
||||
}
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
class: "__TwigTemplate_VarDumperFixture_u75a09"
|
||||
object: __TwigTemplate_VarDumperFixture_u75a09 {
|
||||
%A
|
||||
}
|
||||
src: {
|
||||
%sExceptionCasterTest.php:2: {
|
||||
: foo bar
|
||||
: twig source
|
||||
:
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $f);
|
||||
}
|
||||
}
|
64
Laravel/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
vendored
Normal file
64
Laravel/vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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\Caster\PdoCaster;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class PdoCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @requires extension pdo_sqlite
|
||||
*/
|
||||
public function testCastPdo()
|
||||
{
|
||||
$pdo = new \PDO('sqlite::memory:');
|
||||
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo)));
|
||||
|
||||
$cast = PdoCaster::castPdo($pdo, array(), new Stub(), false);
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]);
|
||||
|
||||
$attr = $cast["\0~\0attributes"] = $cast["\0~\0attributes"]->value;
|
||||
$this->assertInstanceOf('Symfony\Component\VarDumper\Caster\ConstStub', $attr['CASE']);
|
||||
$this->assertSame('NATURAL', $attr['CASE']->class);
|
||||
$this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class);
|
||||
|
||||
$xDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
"\x00~\x00inTransaction" => false
|
||||
"\x00~\x00attributes" => array:9 [
|
||||
"CASE" => NATURAL
|
||||
"ERRMODE" => SILENT
|
||||
"PERSISTENT" => false
|
||||
"DRIVER_NAME" => "sqlite"
|
||||
"ORACLE_NULLS" => NATURAL
|
||||
"CLIENT_VERSION" => "%s"
|
||||
"SERVER_VERSION" => "%s"
|
||||
"STATEMENT_CLASS" => array:%d [
|
||||
0 => "PDOStatement"%A
|
||||
]
|
||||
"DEFAULT_FETCH_MODE" => BOTH
|
||||
]
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast);
|
||||
}
|
||||
}
|
84
Laravel/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
vendored
Normal file
84
Laravel/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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 Nicolas Grekas <p@tchwork.com>
|
||||
* @requires extension redis
|
||||
*/
|
||||
class RedisCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testNotConnected()
|
||||
{
|
||||
$redis = new \Redis();
|
||||
|
||||
if (defined('HHVM_VERSION_ID')) {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {
|
||||
#host: ""
|
||||
%A
|
||||
}
|
||||
EODUMP;
|
||||
} else {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {
|
||||
isConnected: false
|
||||
}
|
||||
EODUMP;
|
||||
}
|
||||
|
||||
$this->assertDumpMatchesFormat($xCast, $redis);
|
||||
}
|
||||
|
||||
public function testConnected()
|
||||
{
|
||||
$redis = new \Redis();
|
||||
if (!@$redis->connect('127.0.0.1')) {
|
||||
$e = error_get_last();
|
||||
self::markTestSkipped($e['message']);
|
||||
}
|
||||
|
||||
if (defined('HHVM_VERSION_ID')) {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {
|
||||
#host: "127.0.0.1"
|
||||
%A
|
||||
}
|
||||
EODUMP;
|
||||
} else {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {%A
|
||||
isConnected: true
|
||||
host: "127.0.0.1"
|
||||
port: 6379
|
||||
auth: null
|
||||
dbNum: 0
|
||||
timeout: 0.0
|
||||
persistentId: null
|
||||
options: {
|
||||
READ_TIMEOUT: 0.0
|
||||
SERIALIZER: NONE
|
||||
PREFIX: null
|
||||
SCAN: NORETRY
|
||||
}
|
||||
}
|
||||
EODUMP;
|
||||
}
|
||||
|
||||
$this->assertDumpMatchesFormat($xCast, $redis);
|
||||
}
|
||||
}
|
235
Laravel/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
vendored
Normal file
235
Laravel/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
<?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;
|
||||
use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
|
||||
use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ReflectionCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testReflectionCaster()
|
||||
{
|
||||
$var = new \ReflectionClass('ReflectionClass');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionClass {
|
||||
+name: "ReflectionClass"
|
||||
%Aimplements: array:%d [
|
||||
0 => "Reflector"
|
||||
%A]
|
||||
constants: array:3 [
|
||||
"IS_IMPLICIT_ABSTRACT" => 16
|
||||
"IS_EXPLICIT_ABSTRACT" => 32
|
||||
"IS_FINAL" => %d
|
||||
]
|
||||
properties: array:%d [
|
||||
"name" => ReflectionProperty {
|
||||
%A +name: "name"
|
||||
+class: "ReflectionClass"
|
||||
%A modifiers: "public"
|
||||
}
|
||||
%A]
|
||||
methods: array:%d [
|
||||
%A
|
||||
"export" => ReflectionMethod {
|
||||
+name: "export"
|
||||
+class: "ReflectionClass"
|
||||
%A parameters: {
|
||||
$%s: ReflectionParameter {
|
||||
%A position: 0
|
||||
%A
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
public function testClosureCaster()
|
||||
{
|
||||
$a = $b = 123;
|
||||
$var = function ($x) use ($a, &$b) {};
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
Closure {
|
||||
%Aparameters: {
|
||||
\$x: {}
|
||||
}
|
||||
use: {
|
||||
\$a: 123
|
||||
\$b: & 123
|
||||
}
|
||||
file: "%sReflectionCasterTest.php"
|
||||
line: "67 to 67"
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
public function testReflectionParameter()
|
||||
{
|
||||
$var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0);
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionParameter {
|
||||
+name: "arg1"
|
||||
position: 0
|
||||
typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass"
|
||||
default: null
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testReflectionParameterScalar()
|
||||
{
|
||||
$f = eval('return function (int $a) {};');
|
||||
$var = new \ReflectionParameter($f, 0);
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionParameter {
|
||||
+name: "a"
|
||||
position: 0
|
||||
typeHint: "int"
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testReturnType()
|
||||
{
|
||||
$f = eval('return function ():int {};');
|
||||
$line = __LINE__ - 1;
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
Closure {
|
||||
returnType: "int"
|
||||
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
|
||||
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
|
||||
file: "%sReflectionCasterTest.php($line) : eval()'d code"
|
||||
line: "1 to 1"
|
||||
}
|
||||
EOTXT
|
||||
, $f
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testGenerator()
|
||||
{
|
||||
if (extension_loaded('xdebug')) {
|
||||
$this->markTestSkipped('xdebug is active');
|
||||
}
|
||||
|
||||
$generator = new GeneratorDemo();
|
||||
$generator = $generator->baz();
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Generator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
executing: {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz(): {
|
||||
%sGeneratorDemo.php:14: {
|
||||
: {
|
||||
: yield from bar();
|
||||
: }
|
||||
}
|
||||
}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $generator);
|
||||
|
||||
foreach ($generator as $v) {
|
||||
break;
|
||||
}
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
0 => ReflectionGenerator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
trace: {
|
||||
%sGeneratorDemo.php:9: {
|
||||
: {
|
||||
: yield 1;
|
||||
: }
|
||||
}
|
||||
%sGeneratorDemo.php:20: {
|
||||
: {
|
||||
: yield from GeneratorDemo::foo();
|
||||
: }
|
||||
}
|
||||
%sGeneratorDemo.php:14: {
|
||||
: {
|
||||
: yield from bar();
|
||||
: }
|
||||
}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
1 => Generator {
|
||||
executing: {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
|
||||
%sGeneratorDemo.php:10: {
|
||||
: yield 1;
|
||||
: }
|
||||
:
|
||||
}
|
||||
}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$r = new \ReflectionGenerator($generator);
|
||||
$this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator()));
|
||||
|
||||
foreach ($generator as $v) {
|
||||
}
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Generator {
|
||||
closed: true
|
||||
}
|
||||
EODUMP;
|
||||
$this->assertDumpMatchesFormat($expectedDump, $generator);
|
||||
}
|
||||
}
|
||||
|
||||
function reflectionParameterFixture(NotLoadableClass $arg1 = null, $arg2)
|
||||
{
|
||||
}
|
147
Laravel/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php
vendored
Normal file
147
Laravel/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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 Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
class SplCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function getCastFileInfoTests()
|
||||
{
|
||||
return array(
|
||||
array(__FILE__, <<<'EOTXT'
|
||||
SplFileInfo {
|
||||
%Apath: "%sCaster"
|
||||
filename: "SplCasterTest.php"
|
||||
basename: "SplCasterTest.php"
|
||||
pathname: "%sSplCasterTest.php"
|
||||
extension: "php"
|
||||
realPath: "%sSplCasterTest.php"
|
||||
aTime: %s-%s-%d %d:%d:%d
|
||||
mTime: %s-%s-%d %d:%d:%d
|
||||
cTime: %s-%s-%d %d:%d:%d
|
||||
inode: %d
|
||||
size: %d
|
||||
perms: 0%d
|
||||
owner: %d
|
||||
group: %d
|
||||
type: "file"
|
||||
writable: true
|
||||
readable: true
|
||||
executable: false
|
||||
file: true
|
||||
dir: false
|
||||
link: false
|
||||
%A}
|
||||
EOTXT
|
||||
),
|
||||
array('https://google.com/about', <<<'EOTXT'
|
||||
SplFileInfo {
|
||||
%Apath: "https://google.com"
|
||||
filename: "about"
|
||||
basename: "about"
|
||||
pathname: "https://google.com/about"
|
||||
extension: ""
|
||||
realPath: false
|
||||
%A}
|
||||
EOTXT
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/** @dataProvider getCastFileInfoTests */
|
||||
public function testCastFileInfo($file, $dump)
|
||||
{
|
||||
$this->assertDumpMatchesFormat($dump, new \SplFileInfo($file));
|
||||
}
|
||||
|
||||
public function testCastFileObject()
|
||||
{
|
||||
$var = new \SplFileObject(__FILE__);
|
||||
$var->setFlags(\SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY);
|
||||
$dump = <<<'EOTXT'
|
||||
SplFileObject {
|
||||
%Apath: "%sCaster"
|
||||
filename: "SplCasterTest.php"
|
||||
basename: "SplCasterTest.php"
|
||||
pathname: "%sSplCasterTest.php"
|
||||
extension: "php"
|
||||
realPath: "%sSplCasterTest.php"
|
||||
aTime: %s-%s-%d %d:%d:%d
|
||||
mTime: %s-%s-%d %d:%d:%d
|
||||
cTime: %s-%s-%d %d:%d:%d
|
||||
inode: %d
|
||||
size: %d
|
||||
perms: 0%d
|
||||
owner: %d
|
||||
group: %d
|
||||
type: "file"
|
||||
writable: true
|
||||
readable: true
|
||||
executable: false
|
||||
file: true
|
||||
dir: false
|
||||
link: false
|
||||
%AcsvControl: array:%d [
|
||||
0 => ","
|
||||
1 => """
|
||||
%A]
|
||||
flags: DROP_NEW_LINE|SKIP_EMPTY
|
||||
maxLineLen: 0
|
||||
fstat: array:26 [
|
||||
"dev" => %d
|
||||
"ino" => %d
|
||||
"nlink" => %d
|
||||
"rdev" => 0
|
||||
"blksize" => %i
|
||||
"blocks" => %i
|
||||
…20
|
||||
]
|
||||
eof: false
|
||||
key: 0
|
||||
}
|
||||
EOTXT;
|
||||
$this->assertDumpMatchesFormat($dump, $var);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideCastSplDoublyLinkedList
|
||||
*/
|
||||
public function testCastSplDoublyLinkedList($modeValue, $modeDump)
|
||||
{
|
||||
$var = new \SplDoublyLinkedList();
|
||||
$var->setIteratorMode($modeValue);
|
||||
$dump = <<<EOTXT
|
||||
SplDoublyLinkedList {
|
||||
%Amode: $modeDump
|
||||
dllist: []
|
||||
}
|
||||
EOTXT;
|
||||
$this->assertDumpMatchesFormat($dump, $var);
|
||||
}
|
||||
|
||||
public function provideCastSplDoublyLinkedList()
|
||||
{
|
||||
return array(
|
||||
array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
|
||||
);
|
||||
}
|
||||
}
|
171
Laravel/vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php
vendored
Normal file
171
Laravel/vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
<?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\Caster\ArgsStub;
|
||||
use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||
use Symfony\Component\VarDumper\Caster\LinkStub;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
use Symfony\Component\VarDumper\Tests\Fixtures\FooInterface;
|
||||
|
||||
class StubCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testArgsStubWithDefaults($foo = 234, $bar = 456)
|
||||
{
|
||||
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
$foo: 123
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testArgsStubWithExtraArgs($foo = 234)
|
||||
{
|
||||
$args = array(new ArgsStub(array(123, 456), __FUNCTION__, __CLASS__));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
$foo: 123
|
||||
...: {
|
||||
456
|
||||
}
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testArgsStubNoParamWithExtraArgs()
|
||||
{
|
||||
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
123
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testArgsStubWithClosure()
|
||||
{
|
||||
$args = array(new ArgsStub(array(123), '{closure}', null));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
123
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testLinkStub()
|
||||
{
|
||||
$var = array(new LinkStub(__CLASS__, 0, __FILE__));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$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:0" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="55 characters">Symfony\Component\VarDumper\Tests\Caster\StubCasterTest</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testClassStub()
|
||||
{
|
||||
$var = array(new ClassStub('hello', array(FooInterface::class, 'foo')));
|
||||
|
||||
$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="%sFooInterface.php:10" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testClassStubWithNotExistingClass()
|
||||
{
|
||||
$var = array(new ClassStub(NotExisting::class));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Caster\NotExisting
|
||||
52 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Caster</span><span class=sf-dump-ellipsis>\</span>NotExisting</span>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testClassStubWithNotExistingMethod()
|
||||
{
|
||||
$var = array(new ClassStub('hello', array(FooInterface::class, 'missing')));
|
||||
|
||||
$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="%sFooInterface.php:5" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
}
|
248
Laravel/vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
vendored
Normal file
248
Laravel/vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
<?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 Baptiste Clavié <clavie.b@gmail.com>
|
||||
*/
|
||||
class XmlReaderCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
/** @var \XmlReader */
|
||||
private $reader;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->reader = new \XmlReader();
|
||||
$this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml');
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->reader->close();
|
||||
}
|
||||
|
||||
public function testParserProperty()
|
||||
{
|
||||
$this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
XMLReader {
|
||||
+nodeType: NONE
|
||||
parserProperties: {
|
||||
SUBST_ENTITIES: true
|
||||
…3
|
||||
}
|
||||
…12
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $this->reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideNodes
|
||||
*/
|
||||
public function testNodes($seek, $expectedDump)
|
||||
{
|
||||
while ($seek--) {
|
||||
$this->reader->read();
|
||||
}
|
||||
$this->assertDumpMatchesFormat($expectedDump, $this->reader);
|
||||
}
|
||||
|
||||
public function provideNodes()
|
||||
{
|
||||
return array(
|
||||
array(0, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+nodeType: NONE
|
||||
…13
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(1, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "foo"
|
||||
+nodeType: ELEMENT
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…11
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(2, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 1
|
||||
+value: """
|
||||
\n
|
||||
|
||||
"""
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(3, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…10
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(4, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: END_ELEMENT
|
||||
+depth: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…10
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(6, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+isEmptyElement: true
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(9, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: TEXT
|
||||
+depth: 2
|
||||
+value: "With text"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(12, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+attributeCount: 2
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(13, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: END_ELEMENT
|
||||
+depth: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…10
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(15, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+attributeCount: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(16, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 2
|
||||
+value: """
|
||||
\n
|
||||
|
||||
"""
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(17, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "baz"
|
||||
+prefix: "baz"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 2
|
||||
+namespaceURI: "http://symfony.com"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…8
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(18, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "baz"
|
||||
+prefix: "baz"
|
||||
+nodeType: END_ELEMENT
|
||||
+depth: 2
|
||||
+namespaceURI: "http://symfony.com"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…8
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(19, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 2
|
||||
+value: """
|
||||
\n
|
||||
|
||||
"""
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(21, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 1
|
||||
+value: "\n"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(22, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "foo"
|
||||
+nodeType: END_ELEMENT
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…11
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
115
Laravel/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php
vendored
Normal file
115
Laravel/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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\Cloner;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
class DataTest extends TestCase
|
||||
{
|
||||
public function testBasicData()
|
||||
{
|
||||
$values = array(1 => 123, 4.5, 'abc', null, false);
|
||||
$data = $this->cloneVar($values);
|
||||
$clonedValues = array();
|
||||
|
||||
$this->assertInstanceOf(Data::class, $data);
|
||||
$this->assertCount(count($values), $data);
|
||||
$this->assertFalse(isset($data->{0}));
|
||||
$this->assertFalse(isset($data[0]));
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
$this->assertTrue(isset($data->{$k}));
|
||||
$this->assertTrue(isset($data[$k]));
|
||||
$this->assertSame(gettype($values[$k]), $data->seek($k)->getType());
|
||||
$this->assertSame($values[$k], $data->seek($k)->getValue());
|
||||
$this->assertSame($values[$k], $data->{$k});
|
||||
$this->assertSame($values[$k], $data[$k]);
|
||||
$this->assertSame((string) $values[$k], (string) $data->seek($k));
|
||||
|
||||
$clonedValues[$k] = $v->getValue();
|
||||
}
|
||||
|
||||
$this->assertSame($values, $clonedValues);
|
||||
}
|
||||
|
||||
public function testObject()
|
||||
{
|
||||
$data = $this->cloneVar(new \Exception('foo'));
|
||||
|
||||
$this->assertSame('Exception', $data->getType());
|
||||
|
||||
$this->assertSame('foo', $data->message);
|
||||
$this->assertSame('foo', $data->{Caster::PREFIX_PROTECTED.'message'});
|
||||
|
||||
$this->assertSame('foo', $data['message']);
|
||||
$this->assertSame('foo', $data[Caster::PREFIX_PROTECTED.'message']);
|
||||
|
||||
$this->assertStringMatchesFormat('Exception (count=%d)', (string) $data);
|
||||
}
|
||||
|
||||
public function testArray()
|
||||
{
|
||||
$values = array(array(), array(123));
|
||||
$data = $this->cloneVar($values);
|
||||
|
||||
$this->assertSame($values, $data->getValue(true));
|
||||
|
||||
$children = $data->getValue();
|
||||
|
||||
$this->assertInternalType('array', $children);
|
||||
|
||||
$this->assertInstanceOf(Data::class, $children[0]);
|
||||
$this->assertInstanceOf(Data::class, $children[1]);
|
||||
|
||||
$this->assertEquals($children[0], $data[0]);
|
||||
$this->assertEquals($children[1], $data[1]);
|
||||
|
||||
$this->assertSame($values[0], $children[0]->getValue(true));
|
||||
$this->assertSame($values[1], $children[1]->getValue(true));
|
||||
}
|
||||
|
||||
public function testStub()
|
||||
{
|
||||
$data = $this->cloneVar(array(new ClassStub('stdClass')));
|
||||
$data = $data[0];
|
||||
|
||||
$this->assertSame('string', $data->getType());
|
||||
$this->assertSame('stdClass', $data->getValue());
|
||||
$this->assertSame('stdClass', (string) $data);
|
||||
}
|
||||
|
||||
public function testHardRefs()
|
||||
{
|
||||
$values = array(array());
|
||||
$values[1] = &$values[0];
|
||||
$values[2][0] = &$values[2];
|
||||
|
||||
$data = $this->cloneVar($values);
|
||||
|
||||
$this->assertSame(array(), $data[0]->getValue());
|
||||
$this->assertSame(array(), $data[1]->getValue());
|
||||
$this->assertEquals(array($data[2]->getValue()), $data[2]->getValue(true));
|
||||
|
||||
$this->assertSame('array (count=3)', (string) $data);
|
||||
}
|
||||
|
||||
private function cloneVar($value)
|
||||
{
|
||||
$cloner = new VarCloner();
|
||||
|
||||
return $cloner->cloneVar($value);
|
||||
}
|
||||
}
|
269
Laravel/vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php
vendored
Normal file
269
Laravel/vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
<?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\Cloner;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class VarClonerTest extends TestCase
|
||||
{
|
||||
public function testMaxIntBoundary()
|
||||
{
|
||||
$data = array(PHP_INT_MAX => 123);
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$clone = $cloner->cloneVar($data);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[1] => 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[%s] => 123
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertSame(sprintf($expected, PHP_INT_MAX), print_r($clone, true));
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$json = json_decode('{"1":{"var":"val"},"2":{"var":"val"}}');
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$clone = $cloner->cloneVar($json);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => stdClass
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 1
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[\000+\0001] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => stdClass
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 2
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[\000+\0002] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => stdClass
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 3
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[\000+\000var] => val
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[\000+\000var] => val
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertStringMatchesFormat($expected, print_r($clone, true));
|
||||
}
|
||||
|
||||
public function testJsonCast()
|
||||
{
|
||||
if (ini_get('xdebug.overload_var_dump') == 2) {
|
||||
$this->markTestSkipped('xdebug is active');
|
||||
}
|
||||
|
||||
$data = (array) json_decode('{"1":{}}');
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$clone = $cloner->cloneVar($data);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
object(Symfony\Component\VarDumper\Cloner\Data)#%i (6) {
|
||||
["data":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["1"]=>
|
||||
object(Symfony\Component\VarDumper\Cloner\Stub)#%i (8) {
|
||||
["type"]=>
|
||||
int(4)
|
||||
["class"]=>
|
||||
string(8) "stdClass"
|
||||
["value"]=>
|
||||
NULL
|
||||
["cut"]=>
|
||||
int(0)
|
||||
["handle"]=>
|
||||
int(%i)
|
||||
["refCount"]=>
|
||||
int(0)
|
||||
["position"]=>
|
||||
int(0)
|
||||
["attr"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
["position":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(0)
|
||||
["key":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(0)
|
||||
["maxDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(20)
|
||||
["maxItemsPerDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(-1)
|
||||
["useRefHandles":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(-1)
|
||||
}
|
||||
|
||||
EOTXT;
|
||||
ob_start();
|
||||
var_dump($clone);
|
||||
$this->assertStringMatchesFormat(\PHP_VERSION_ID >= 70200 ? str_replace('"1"', '1', $expected) : $expected, ob_get_clean());
|
||||
}
|
||||
|
||||
public function testCaster()
|
||||
{
|
||||
$cloner = new VarCloner(array(
|
||||
'*' => function ($obj, $array) {
|
||||
return array('foo' => 123);
|
||||
},
|
||||
__CLASS__ => function ($obj, $array) {
|
||||
++$array['foo'];
|
||||
|
||||
return $array;
|
||||
},
|
||||
));
|
||||
$clone = $cloner->cloneVar($this);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => %s
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 1
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[foo] => 124
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertStringMatchesFormat($expected, print_r($clone, true));
|
||||
}
|
||||
}
|
575
Laravel/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php
vendored
Normal file
575
Laravel/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php
vendored
Normal file
@@ -0,0 +1,575 @@
|
||||
<?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\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CliDumperTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
require __DIR__.'/../Fixtures/dumb-var.php';
|
||||
|
||||
$dumper = new CliDumper('php://output');
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(array(
|
||||
':stream' => function ($res, $a) {
|
||||
unset($a['uri'], $a['wrapper_data']);
|
||||
|
||||
return $a;
|
||||
},
|
||||
));
|
||||
$data = $cloner->cloneVar($var);
|
||||
|
||||
ob_start();
|
||||
$dumper->dump($data);
|
||||
$out = ob_get_clean();
|
||||
$out = preg_replace('/[ \t]+$/m', '', $out);
|
||||
$intMax = PHP_INT_MAX;
|
||||
$res = (int) $var['res'];
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
array:24 [
|
||||
"number" => 1
|
||||
0 => &1 null
|
||||
"const" => 1.1
|
||||
1 => true
|
||||
2 => false
|
||||
3 => NAN
|
||||
4 => INF
|
||||
5 => -INF
|
||||
6 => {$intMax}
|
||||
"str" => "déjà\\n"
|
||||
7 => b"é\\x00"
|
||||
"[]" => []
|
||||
"res" => stream resource {@{$res}
|
||||
%A wrapper_type: "plainfile"
|
||||
stream_type: "STDIO"
|
||||
mode: "r"
|
||||
unread_bytes: 0
|
||||
seekable: true
|
||||
%A options: []
|
||||
}
|
||||
"obj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d
|
||||
+foo: "foo"
|
||||
+"bar": "bar"
|
||||
}
|
||||
"closure" => Closure {{$r}
|
||||
class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest"
|
||||
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {{$r} …}
|
||||
parameters: {
|
||||
\$a: {}
|
||||
&\$b: {
|
||||
typeHint: "PDO"
|
||||
default: null
|
||||
}
|
||||
}
|
||||
file: "{$var['file']}"
|
||||
line: "{$var['line']} to {$var['line']}"
|
||||
}
|
||||
"line" => {$var['line']}
|
||||
"nobj" => array:1 [
|
||||
0 => &3 {#%d}
|
||||
]
|
||||
"recurs" => &4 array:1 [
|
||||
0 => &4 array:1 [&4]
|
||||
]
|
||||
8 => &1 null
|
||||
"sobj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d}
|
||||
"snobj" => &3 {#%d}
|
||||
"snobj2" => {#%d}
|
||||
"file" => "{$var['file']}"
|
||||
b"bin-key-é" => ""
|
||||
]
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDumpWithCommaFlagTests
|
||||
*/
|
||||
public function testDumpWithCommaFlag($expected, $flags)
|
||||
{
|
||||
$dumper = new CliDumper(null, null, $flags);
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$var = array(
|
||||
'array' => array('a', 'b'),
|
||||
'string' => 'hello',
|
||||
'multiline string' => "this\nis\na\multiline\nstring",
|
||||
);
|
||||
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$this->assertSame($expected, $dump);
|
||||
}
|
||||
|
||||
public function provideDumpWithCommaFlagTests()
|
||||
{
|
||||
$expected = <<<'EOTXT'
|
||||
array:3 [
|
||||
"array" => array:2 [
|
||||
0 => "a",
|
||||
1 => "b"
|
||||
],
|
||||
"string" => "hello",
|
||||
"multiline string" => """
|
||||
this\n
|
||||
is\n
|
||||
a\multiline\n
|
||||
string
|
||||
"""
|
||||
]
|
||||
|
||||
EOTXT;
|
||||
|
||||
yield array($expected, CliDumper::DUMP_COMMA_SEPARATOR);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
array:3 [
|
||||
"array" => array:2 [
|
||||
0 => "a",
|
||||
1 => "b",
|
||||
],
|
||||
"string" => "hello",
|
||||
"multiline string" => """
|
||||
this\n
|
||||
is\n
|
||||
a\multiline\n
|
||||
string
|
||||
""",
|
||||
]
|
||||
|
||||
EOTXT;
|
||||
|
||||
yield array($expected, CliDumper::DUMP_TRAILING_COMMA);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension xml
|
||||
*/
|
||||
public function testXmlResource()
|
||||
{
|
||||
$var = xml_parser_create();
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
xml resource {
|
||||
current_byte_index: %i
|
||||
current_column_number: %i
|
||||
current_line_number: 1
|
||||
error_code: XML_ERROR_NONE
|
||||
}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
|
||||
public function testJsonCast()
|
||||
{
|
||||
$var = (array) json_decode('{"0":{},"1":null}');
|
||||
foreach ($var as &$v) {
|
||||
}
|
||||
$var[] = &$v;
|
||||
$var[''] = 2;
|
||||
|
||||
if (\PHP_VERSION_ID >= 70200) {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
array:4 [
|
||||
0 => {}
|
||||
1 => &1 null
|
||||
2 => &1 null
|
||||
"" => 2
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
} else {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
array:4 [
|
||||
"0" => {}
|
||||
"1" => &1 null
|
||||
0 => &1 null
|
||||
"" => 2
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testObjectCast()
|
||||
{
|
||||
$var = (object) array(1 => 1);
|
||||
$var->{1} = 2;
|
||||
|
||||
if (\PHP_VERSION_ID >= 70200) {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
{
|
||||
+"1": 2
|
||||
}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
} else {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
{
|
||||
+1: 1
|
||||
+"1": 2
|
||||
}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testClosedResource()
|
||||
{
|
||||
if (defined('HHVM_VERSION') && HHVM_VERSION_ID < 30600) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$var = fopen(__FILE__, 'r');
|
||||
fclose($var);
|
||||
|
||||
$dumper = new CliDumper('php://output');
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
$data = $cloner->cloneVar($var);
|
||||
|
||||
ob_start();
|
||||
$dumper->dump($data);
|
||||
$out = ob_get_clean();
|
||||
$res = (int) $var;
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
Closed resource @{$res}
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testFlags()
|
||||
{
|
||||
putenv('DUMP_LIGHT_ARRAY=1');
|
||||
putenv('DUMP_STRING_LENGTH=1');
|
||||
|
||||
$var = array(
|
||||
range(1, 3),
|
||||
array('foo', 2 => 'bar'),
|
||||
);
|
||||
|
||||
$this->assertDumpEquals(
|
||||
<<<EOTXT
|
||||
[
|
||||
[
|
||||
1
|
||||
2
|
||||
3
|
||||
]
|
||||
[
|
||||
0 => (3) "foo"
|
||||
2 => (3) "bar"
|
||||
]
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
|
||||
putenv('DUMP_LIGHT_ARRAY=');
|
||||
putenv('DUMP_STRING_LENGTH=');
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires function Twig\Template::getSourceContext
|
||||
*/
|
||||
public function testThrowingCaster()
|
||||
{
|
||||
$out = fopen('php://memory', 'r+b');
|
||||
|
||||
require_once __DIR__.'/../Fixtures/Twig.php';
|
||||
$twig = new \__TwigTemplate_VarDumperFixture_u75a09(new Environment(new FilesystemLoader()));
|
||||
|
||||
$dumper = new CliDumper();
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(array(
|
||||
':stream' => function ($res, $a) {
|
||||
unset($a['wrapper_data']);
|
||||
|
||||
return $a;
|
||||
},
|
||||
));
|
||||
$cloner->addCasters(array(
|
||||
':stream' => eval('return function () use ($twig) {
|
||||
try {
|
||||
$twig->render(array());
|
||||
} catch (\Twig\Error\RuntimeError $e) {
|
||||
throw $e->getPrevious();
|
||||
}
|
||||
};'),
|
||||
));
|
||||
$ref = (int) $out;
|
||||
|
||||
$data = $cloner->cloneVar($out);
|
||||
$dumper->dump($data, $out);
|
||||
$out = stream_get_contents($out, -1, 0);
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
stream resource {@{$ref}
|
||||
⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {{$r}
|
||||
#message: "Unexpected Exception thrown from a caster: Foobar"
|
||||
trace: {
|
||||
%sTwig.php:2: {
|
||||
: foo bar
|
||||
: twig source
|
||||
:
|
||||
}
|
||||
%sTemplate.php:%d: {
|
||||
: try {
|
||||
: \$this->doDisplay(\$context, \$blocks);
|
||||
: } catch (Twig%sError \$e) {
|
||||
}
|
||||
%sTemplate.php:%d: {
|
||||
: {
|
||||
: \$this->displayWithErrorHandling(\$this->env->mergeGlobals(\$context), array_merge(\$this->blocks, \$blocks));
|
||||
: }
|
||||
}
|
||||
%sTemplate.php:%d: {
|
||||
: try {
|
||||
: \$this->display(\$context);
|
||||
: } catch (%s \$e) {
|
||||
}
|
||||
%sCliDumperTest.php:%d: {
|
||||
%A
|
||||
}
|
||||
}
|
||||
}
|
||||
%Awrapper_type: "PHP"
|
||||
stream_type: "MEMORY"
|
||||
mode: "%s+b"
|
||||
unread_bytes: 0
|
||||
seekable: true
|
||||
uri: "php://memory"
|
||||
%Aoptions: []
|
||||
}
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testRefsInProperties()
|
||||
{
|
||||
$var = (object) array('foo' => 'foo');
|
||||
$var->bar = &$var->foo;
|
||||
|
||||
$dumper = new CliDumper();
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$data = $cloner->cloneVar($var);
|
||||
$out = $dumper->dump($data, true);
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
{{$r}
|
||||
+"foo": &1 "foo"
|
||||
+"bar": &1 "foo"
|
||||
}
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @requires PHP 5.6
|
||||
*/
|
||||
public function testSpecialVars56()
|
||||
{
|
||||
$var = $this->getSpecialVars();
|
||||
|
||||
$this->assertDumpEquals(
|
||||
<<<'EOTXT'
|
||||
array:3 [
|
||||
0 => array:1 [
|
||||
0 => &1 array:1 [
|
||||
0 => &1 array:1 [&1]
|
||||
]
|
||||
]
|
||||
1 => array:1 [
|
||||
"GLOBALS" => &2 array:1 [
|
||||
"GLOBALS" => &2 array:1 [&2]
|
||||
]
|
||||
]
|
||||
2 => &2 array:1 [&2]
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testGlobalsNoExt()
|
||||
{
|
||||
$var = $this->getSpecialVars();
|
||||
unset($var[0]);
|
||||
$out = '';
|
||||
|
||||
$dumper = new CliDumper(function ($line, $depth) use (&$out) {
|
||||
if ($depth >= 0) {
|
||||
$out .= str_repeat(' ', $depth).$line."\n";
|
||||
}
|
||||
});
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$refl = new \ReflectionProperty($cloner, 'useExt');
|
||||
$refl->setAccessible(true);
|
||||
$refl->setValue($cloner, false);
|
||||
|
||||
$data = $cloner->cloneVar($var);
|
||||
$dumper->dump($data);
|
||||
|
||||
$this->assertSame(
|
||||
<<<'EOTXT'
|
||||
array:2 [
|
||||
1 => array:1 [
|
||||
"GLOBALS" => &1 array:1 [
|
||||
"GLOBALS" => &1 array:1 [&1]
|
||||
]
|
||||
]
|
||||
2 => &1 array:1 [&1]
|
||||
]
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testBuggyRefs()
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
$this->markTestSkipped('PHP 5.6 fixed refs counting');
|
||||
}
|
||||
|
||||
$var = $this->getSpecialVars();
|
||||
$var = $var[0];
|
||||
|
||||
$dumper = new CliDumper();
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$data = $cloner->cloneVar($var)->withMaxDepth(3);
|
||||
$out = '';
|
||||
$dumper->dump($data, function ($line, $depth) use (&$out) {
|
||||
if ($depth >= 0) {
|
||||
$out .= str_repeat(' ', $depth).$line."\n";
|
||||
}
|
||||
});
|
||||
|
||||
$this->assertSame(
|
||||
<<<'EOTXT'
|
||||
array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [ …1]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testIncompleteClass()
|
||||
{
|
||||
$unserializeCallbackHandler = ini_set('unserialize_callback_func', null);
|
||||
$var = unserialize('O:8:"Foo\Buzz":0:{}');
|
||||
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
__PHP_Incomplete_Class(Foo\Buzz) {}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
|
||||
private function getSpecialVars()
|
||||
{
|
||||
foreach (array_keys($GLOBALS) as $var) {
|
||||
if ('GLOBALS' !== $var) {
|
||||
unset($GLOBALS[$var]);
|
||||
}
|
||||
}
|
||||
|
||||
$var = function &() {
|
||||
$var = array();
|
||||
$var[] = &$var;
|
||||
|
||||
return $var;
|
||||
};
|
||||
|
||||
return array($var(), $GLOBALS, &$GLOBALS);
|
||||
}
|
||||
}
|
164
Laravel/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php
vendored
Normal file
164
Laravel/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
<?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\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class HtmlDumperTest extends TestCase
|
||||
{
|
||||
public function testGet()
|
||||
{
|
||||
require __DIR__.'/../Fixtures/dumb-var.php';
|
||||
|
||||
$dumper = new HtmlDumper('php://output');
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(array(
|
||||
':stream' => function ($res, $a) {
|
||||
unset($a['uri'], $a['wrapper_data']);
|
||||
|
||||
return $a;
|
||||
},
|
||||
));
|
||||
$data = $cloner->cloneVar($var);
|
||||
|
||||
ob_start();
|
||||
$dumper->dump($data);
|
||||
$out = ob_get_clean();
|
||||
$out = preg_replace('/[ \t]+$/m', '', $out);
|
||||
$var['file'] = htmlspecialchars($var['file'], ENT_QUOTES, 'UTF-8');
|
||||
$intMax = PHP_INT_MAX;
|
||||
preg_match('/sf-dump-\d+/', $out, $dumpId);
|
||||
$dumpId = $dumpId[0];
|
||||
$res = (int) $var['res'];
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '<a class=sf-dump-ref>#%d</a>';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
<foo></foo><bar><span class=sf-dump-note>array:24</span> [<samp>
|
||||
"<span class=sf-dump-key>number</span>" => <span class=sf-dump-num>1</span>
|
||||
<span class=sf-dump-key>0</span> => <a class=sf-dump-ref href=#{$dumpId}-ref01 title="2 occurrences">&1</a> <span class=sf-dump-const>null</span>
|
||||
"<span class=sf-dump-key>const</span>" => <span class=sf-dump-num>1.1</span>
|
||||
<span class=sf-dump-key>1</span> => <span class=sf-dump-const>true</span>
|
||||
<span class=sf-dump-key>2</span> => <span class=sf-dump-const>false</span>
|
||||
<span class=sf-dump-key>3</span> => <span class=sf-dump-num>NAN</span>
|
||||
<span class=sf-dump-key>4</span> => <span class=sf-dump-num>INF</span>
|
||||
<span class=sf-dump-key>5</span> => <span class=sf-dump-num>-INF</span>
|
||||
<span class=sf-dump-key>6</span> => <span class=sf-dump-num>{$intMax}</span>
|
||||
"<span class=sf-dump-key>str</span>" => "<span class=sf-dump-str title="5 characters">d&%s;j&%s;<span class=sf-dump-default>\\n</span></span>"
|
||||
<span class=sf-dump-key>7</span> => b"<span class=sf-dump-str title="2 binary or non-UTF-8 characters">&%s;<span class=sf-dump-default>\\x00</span></span>"
|
||||
"<span class=sf-dump-key>[]</span>" => []
|
||||
"<span class=sf-dump-key>res</span>" => <span class=sf-dump-note>stream resource</span> <a class=sf-dump-ref>@{$res}</a><samp>
|
||||
%A <span class=sf-dump-meta>wrapper_type</span>: "<span class=sf-dump-str title="9 characters">plainfile</span>"
|
||||
<span class=sf-dump-meta>stream_type</span>: "<span class=sf-dump-str title="5 characters">STDIO</span>"
|
||||
<span class=sf-dump-meta>mode</span>: "<span class=sf-dump-str>r</span>"
|
||||
<span class=sf-dump-meta>unread_bytes</span>: <span class=sf-dump-num>0</span>
|
||||
<span class=sf-dump-meta>seekable</span>: <span class=sf-dump-const>true</span>
|
||||
%A <span class=sf-dump-meta>options</span>: []
|
||||
</samp>}
|
||||
"<span class=sf-dump-key>obj</span>" => <abbr title="Symfony\Component\VarDumper\Tests\Fixture\DumbFoo" class=sf-dump-note>DumbFoo</abbr> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="2 occurrences">#%d</a><samp id={$dumpId}-ref2%d>
|
||||
+<span class=sf-dump-public title="Public property">foo</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
|
||||
+"<span class=sf-dump-public title="Runtime added dynamic property">bar</span>": "<span class=sf-dump-str title="3 characters">bar</span>"
|
||||
</samp>}
|
||||
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure</span> {{$r}<samp>
|
||||
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest
|
||||
55 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Dumper</span><span class=sf-dump-ellipsis>\</span>HtmlDumperTest</span>"
|
||||
<span class=sf-dump-meta>this</span>: <abbr title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest" class=sf-dump-note>HtmlDumperTest</abbr> {{$r} &%s;}
|
||||
<span class=sf-dump-meta>parameters</span>: {<samp>
|
||||
<span class=sf-dump-meta>\$a</span>: {}
|
||||
<span class=sf-dump-meta>&\$b</span>: {<samp>
|
||||
<span class=sf-dump-meta>typeHint</span>: "<span class=sf-dump-str title="3 characters">PDO</span>"
|
||||
<span class=sf-dump-meta>default</span>: <span class=sf-dump-const>null</span>
|
||||
</samp>}
|
||||
</samp>}
|
||||
<span class=sf-dump-meta>file</span>: "<span class=sf-dump-str title="{$var['file']}
|
||||
%d characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eFixtures%edumb-var.php</span>"
|
||||
<span class=sf-dump-meta>line</span>: "<span class=sf-dump-str title="%d characters">{$var['line']} to {$var['line']}</span>"
|
||||
</samp>}
|
||||
"<span class=sf-dump-key>line</span>" => <span class=sf-dump-num>{$var['line']}</span>
|
||||
"<span class=sf-dump-key>nobj</span>" => <span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => <a class=sf-dump-ref href=#{$dumpId}-ref03 title="2 occurrences">&3</a> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="3 occurrences">#%d</a>}
|
||||
</samp>]
|
||||
"<span class=sf-dump-key>recurs</span>" => <a class=sf-dump-ref href=#{$dumpId}-ref04 title="2 occurrences">&4</a> <span class=sf-dump-note>array:1</span> [<samp id={$dumpId}-ref04>
|
||||
<span class=sf-dump-index>0</span> => <a class=sf-dump-ref href=#{$dumpId}-ref04 title="2 occurrences">&4</a> <span class=sf-dump-note>array:1</span> [<a class=sf-dump-ref href=#{$dumpId}-ref04 title="2 occurrences">&4</a>]
|
||||
</samp>]
|
||||
<span class=sf-dump-key>8</span> => <a class=sf-dump-ref href=#{$dumpId}-ref01 title="2 occurrences">&1</a> <span class=sf-dump-const>null</span>
|
||||
"<span class=sf-dump-key>sobj</span>" => <abbr title="Symfony\Component\VarDumper\Tests\Fixture\DumbFoo" class=sf-dump-note>DumbFoo</abbr> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="2 occurrences">#%d</a>}
|
||||
"<span class=sf-dump-key>snobj</span>" => <a class=sf-dump-ref href=#{$dumpId}-ref03 title="2 occurrences">&3</a> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="3 occurrences">#%d</a>}
|
||||
"<span class=sf-dump-key>snobj2</span>" => {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="3 occurrences">#%d</a>}
|
||||
"<span class=sf-dump-key>file</span>" => "<span class=sf-dump-str title="%d characters">{$var['file']}</span>"
|
||||
b"<span class=sf-dump-key>bin-key-&%s;</span>" => ""
|
||||
</samp>]
|
||||
</bar>
|
||||
|
||||
EOTXT
|
||||
,
|
||||
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testCharset()
|
||||
{
|
||||
$var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8');
|
||||
|
||||
$dumper = new HtmlDumper('php://output', 'CP1251');
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$data = $cloner->cloneVar($var);
|
||||
$out = $dumper->dump($data, true);
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
<foo></foo><bar>b"<span class=sf-dump-str title="7 binary or non-UTF-8 characters">Словарь</span>"
|
||||
</bar>
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testAppend()
|
||||
{
|
||||
$out = fopen('php://memory', 'r+b');
|
||||
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$dumper->dump($cloner->cloneVar(123), $out);
|
||||
$dumper->dump($cloner->cloneVar(456), $out);
|
||||
|
||||
$out = stream_get_contents($out, -1, 0);
|
||||
|
||||
$this->assertSame(<<<'EOTXT'
|
||||
<foo></foo><bar><span class=sf-dump-num>123</span>
|
||||
</bar>
|
||||
<bar><span class=sf-dump-num>456</span>
|
||||
</bar>
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
}
|
11
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php
vendored
Normal file
11
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixtures;
|
||||
|
||||
interface FooInterface
|
||||
{
|
||||
/**
|
||||
* Hello.
|
||||
*/
|
||||
public function foo();
|
||||
}
|
21
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/GeneratorDemo.php
vendored
Normal file
21
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/GeneratorDemo.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixtures;
|
||||
|
||||
class GeneratorDemo
|
||||
{
|
||||
public static function foo()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
|
||||
public function baz()
|
||||
{
|
||||
yield from bar();
|
||||
}
|
||||
}
|
||||
|
||||
function bar()
|
||||
{
|
||||
yield from GeneratorDemo::foo();
|
||||
}
|
7
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php
vendored
Normal file
7
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixtures;
|
||||
|
||||
class NotLoadableClass extends NotLoadableClass
|
||||
{
|
||||
}
|
38
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/Twig.php
vendored
Normal file
38
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/Twig.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_VarDumperFixture_u75a09 extends Twig\Template
|
||||
{
|
||||
private $path;
|
||||
|
||||
public function __construct(Twig\Environment $env = null, $path = null)
|
||||
{
|
||||
if (null !== $env) {
|
||||
parent::__construct($env);
|
||||
}
|
||||
$this->parent = false;
|
||||
$this->blocks = array();
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
protected function doDisplay(array $context, array $blocks = array())
|
||||
{
|
||||
// line 2
|
||||
throw new \Exception('Foobar');
|
||||
}
|
||||
|
||||
public function getTemplateName()
|
||||
{
|
||||
return 'foo.twig';
|
||||
}
|
||||
|
||||
public function getDebugInfo()
|
||||
{
|
||||
return array(20 => 1, 21 => 2);
|
||||
}
|
||||
|
||||
public function getSourceContext()
|
||||
{
|
||||
return new Twig\Source(" foo bar\n twig source\n\n", 'foo.twig', $this->path ?: __FILE__);
|
||||
}
|
||||
}
|
40
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php
vendored
Normal file
40
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixture;
|
||||
|
||||
if (!class_exists('Symfony\Component\VarDumper\Tests\Fixture\DumbFoo')) {
|
||||
class DumbFoo
|
||||
{
|
||||
public $foo = 'foo';
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new DumbFoo();
|
||||
$foo->bar = 'bar';
|
||||
|
||||
$g = fopen(__FILE__, 'r');
|
||||
|
||||
$var = array(
|
||||
'number' => 1, null,
|
||||
'const' => 1.1, true, false, NAN, INF, -INF, PHP_INT_MAX,
|
||||
'str' => "déjà\n", "\xE9\x00",
|
||||
'[]' => array(),
|
||||
'res' => $g,
|
||||
'obj' => $foo,
|
||||
'closure' => function ($a, \PDO &$b = null) {},
|
||||
'line' => __LINE__ - 1,
|
||||
'nobj' => array((object) array()),
|
||||
);
|
||||
|
||||
$r = array();
|
||||
$r[] = &$r;
|
||||
|
||||
$var['recurs'] = &$r;
|
||||
$var[] = &$var[0];
|
||||
$var['sobj'] = $var['obj'];
|
||||
$var['snobj'] = &$var['nobj'][0];
|
||||
$var['snobj2'] = $var['nobj'][0];
|
||||
$var['file'] = __FILE__;
|
||||
$var["bin-key-\xE9"] = '';
|
||||
|
||||
unset($g, $r);
|
10
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
vendored
Normal file
10
Laravel/vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar></bar>
|
||||
<bar />
|
||||
<bar>With text</bar>
|
||||
<bar foo="bar" baz="fubar"></bar>
|
||||
<bar xmlns:baz="http://symfony.com">
|
||||
<baz:baz></baz:baz>
|
||||
</bar>
|
||||
</foo>
|
41
Laravel/vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
vendored
Normal file
41
Laravel/vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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\Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
class VarDumperTestTraitTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testItComparesLargeData()
|
||||
{
|
||||
$howMany = 700;
|
||||
$data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd'));
|
||||
|
||||
$expected = sprintf("array:%d [\n", $howMany + 1);
|
||||
for ($i = 0; $i <= $howMany; ++$i) {
|
||||
$expected .= <<<EODUMP
|
||||
$i => array:4 [
|
||||
0 => "a"
|
||||
1 => "b"
|
||||
2 => "c"
|
||||
3 => "d"
|
||||
]\n
|
||||
EODUMP;
|
||||
}
|
||||
$expected .= "]\n";
|
||||
|
||||
$this->assertDumpEquals($expected, $data);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user