Ejemplo n.º 1
0
 public function containerBuilderProvider()
 {
     static $counter;
     // Generate a temp file
     $tmpDir = __DIR__ . '/tmp/';
     $tmpFilePrefix = 'Integration' . sprintf('%02d', ++$counter);
     $tmpFileSuffix = '.php';
     $counter2 = 0;
     do {
         $className = $tmpFilePrefix . ($counter2++ ? '_' . $counter2 : '');
         //$className = $tmpFilePrefix . base_convert(mt_rand(0, PHP_INT_MAX), 10, 36);
         $tmpFile = $tmpDir . $className . $tmpFileSuffix;
     } while (file_exists($tmpFile));
     // Make the container builders
     $defaultContainerBuilder = new Builder();
     $compileContainerBuilder = new Builder();
     $compileContainerBuilder->ttl(0)->stat(false)->file($tmpFile)->className('zdi\\Tests\\Gen\\' . $className);
     $precompiledContainerBuilder = clone $compileContainerBuilder;
     $precompiledContainerBuilder->precompiled(true);
     return array(array($defaultContainerBuilder), array($compileContainerBuilder), array($precompiledContainerBuilder));
 }
Ejemplo n.º 2
0
 public function testReadOnlyCompiledFile()
 {
     $this->setExpectedException(Exception\IOException::class);
     $builder = new ContainerBuilder();
     // This doesn't seem to be working on travis
     //$builder->file(__DIR__ . '/../Fixture/read-only-file.php');
     $builder->file(__DIR__ . '/../Fixture/missing-dir/read-only-file.php');
     $builder->className('AnyClassName');
     $builder->ttl(0);
     $builder->build();
 }