1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
--TEST--
Verifies that lazy loading value holder factory can generate proxy for PHP core classes.
?>
--SKIPIF--
<?php
require_once __DIR__ . '/init.php';
try {
if (PHP_VERSION_ID >= 80000) {
Laminas\Code\Generator\TypeGenerator::fromTypeString('array|string');
}
} catch (\InvalidArgumentException $e) {
die('skip laminas/laminas-code >= 3.5 must be installed');
}
--FILE--
<?php
require_once __DIR__ . '/init.php';
class PharMock extends Phar
{
public function __construct()
{
}
public function compress($compression_type, $file_ext = null): ?Phar
{
echo $compression_type;
return null;
}
}
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($configuration);
$factory
->createProxy(Phar::class, function (& $wrapped, $proxy, $method, array $parameters, & $initializer) {
$initializer = null;
$wrapped = new PharMock();
})
->compress(123);
?>
--EXPECT--
123
|