Skip to content
Permalink
Browse files

Runner: added method addPhpIniOption()

To be able adjust PHP INI options from --setup script.
  • Loading branch information...
milo committed Mar 9, 2019
1 parent cb737eb commit 2cd6160e9e8cdc670df0cbc6dba42f4ad23953fc
Showing with 19 additions and 1 deletion.
  1. +6 βˆ’0 src/Runner/Runner.php
  2. +6 βˆ’1 tests/Runner/Runner.misc.phpt
  3. +7 βˆ’0 tests/Runner/misc/addPhpIniOption.phptx
@@ -73,6 +73,12 @@ public function getEnvironmentVariables(): array
}
public function addPhpIniOption(string $name, string $value = null): void
{
$this->interpreter = $this->interpreter->withPhpIniOption($name, $value);
}
public function setTempDirectory(?string $path): void
{
if ($path !== null) {
@@ -44,8 +44,13 @@ $runner = new Tester\Runner\Runner(createInterpreter());
$runner->paths[] = __DIR__ . '/misc/*.phptx';
$runner->outputHandlers[] = $logger = new Logger;
$runner->setEnvironmentVariable('TesterEnvVar', 'Is here!');
$runner->addPhpIniOption('default_mimetype', 'bar/baz');
$runner->run();
Assert::false(getenv('TesterEnvVar'));
Assert::same(Test::PASSED, $logger->results['env-vars.phptx']);
ksort($logger->results);
Assert::same([
'addPhpIniOption.phptx' => Test::PASSED,
'env-vars.phptx' => Test::PASSED,
], $logger->results);
@@ -0,0 +1,7 @@
<?php

use Tester\Assert;

require __DIR__ . '/../../bootstrap.php';

Assert::same('bar/baz', ini_get('default_mimetype'));

0 comments on commit 2cd6160

Please sign in to comment.
You can’t perform that action at this time.