X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fvar-dumper%2FTests%2FVarClonerTest.php;fp=vendor%2Fsymfony%2Fvar-dumper%2FTests%2FVarClonerTest.php;h=0000000000000000000000000000000000000000;hp=8ca59bdddfe71e591b89982e8aba09c07c9e9ac6;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/var-dumper/Tests/VarClonerTest.php b/vendor/symfony/var-dumper/Tests/VarClonerTest.php deleted file mode 100644 index 8ca59bddd..000000000 --- a/vendor/symfony/var-dumper/Tests/VarClonerTest.php +++ /dev/null @@ -1,258 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\VarDumper\Cloner\VarCloner; - -/** - * @author Nicolas Grekas - */ -class VarClonerTest extends TestCase -{ - public function testMaxIntBoundary() - { - $data = array(PHP_INT_MAX => 123); - - $cloner = new VarCloner(); - $clone = $cloner->cloneVar($data); - - $expected = << Array - ( - [0] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => array - [class] => assoc - [value] => 1 - [cut] => 0 - [handle] => 0 - [refCount] => 0 - [position] => 1 - ) - - ) - - [1] => Array - ( - [%s] => 123 - ) - - ) - - [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 = << Array - ( - [0] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => object - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 1 - ) - - ) - - [1] => Array - ( - [\000+\0001] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => object - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 2 - ) - - [\000+\0002] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => object - [class] => stdClass - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 3 - ) - - ) - - [2] => Array - ( - [\000+\000var] => val - ) - - [3] => Array - ( - [\000+\000var] => val - ) - - ) - - [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 (4) { - ["data":"Symfony\Component\VarDumper\Cloner\Data":private]=> - array(2) { - [0]=> - array(1) { - [0]=> - object(Symfony\Component\VarDumper\Cloner\Stub)#%i (7) { - ["type"]=> - string(5) "array" - ["class"]=> - string(5) "assoc" - ["value"]=> - int(1) - ["cut"]=> - int(0) - ["handle"]=> - int(0) - ["refCount"]=> - int(0) - ["position"]=> - int(1) - } - } - [1]=> - array(1) { - ["1"]=> - object(Symfony\Component\VarDumper\Cloner\Stub)#%i (7) { - ["type"]=> - string(6) "object" - ["class"]=> - string(8) "stdClass" - ["value"]=> - NULL - ["cut"]=> - int(0) - ["handle"]=> - int(%i) - ["refCount"]=> - int(0) - ["position"]=> - 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($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 = << Array - ( - [0] => Array - ( - [0] => Symfony\Component\VarDumper\Cloner\Stub Object - ( - [type] => object - [class] => %s - [value] => - [cut] => 0 - [handle] => %i - [refCount] => 0 - [position] => 1 - ) - - ) - - [1] => Array - ( - [foo] => 124 - ) - - ) - - [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)); - } -}