Files
san-reymoros/vendor/ocramius/proxy-manager/tests/language-feature-scripts/lazy-loading-value-holder-with-cache.phpt
Gauvain Boiché 5e4c5f9418 Ajout du FR
Ajout du FR + correction du "functions.php"
2020-03-30 14:52:34 +02:00

40 lines
1.1 KiB
PHP

--TEST--
Verifies that lazy loading value holder proxy file is generated
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen
{
private $sweets = 'candy';
}
$configuration->setProxiesTargetDir(__DIR__ . '/cache');
$fileLocator = new \ProxyManager\FileLocator\FileLocator($configuration->getProxiesTargetDir());
$configuration->setGeneratorStrategy(
new \ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy($fileLocator)
);
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($configuration);
$proxy = $factory->createProxy('Kitchen', function (& $wrapped, $proxy, $method, array $parameters, & $initializer) {
$initializer = null;
$wrapped = new Kitchen();
});
$filename = $fileLocator->getProxyFileName(get_class($proxy));
var_dump(file_exists($filename));
$proxy = $factory->createProxy('Kitchen', function (& $wrapped, $proxy, $method, array $parameters, & $initializer) {
$initializer = null;
$wrapped = new Kitchen();
});
var_dump(file_exists($filename));
@unlink($filename);
?>
--EXPECT--
bool(true)
bool(true)