Example #1
0
 public function testLoadConfigFile()
 {
     $config = new Configuration(array('configFile' => __DIR__ . '/../../fixtures/rc.php'));
     $tempDir = $this->joinPath(realpath(sys_get_temp_dir()), 'psysh_test', 'withconfig', 'temp');
     $this->assertStringStartsWith($tempDir, realpath($config->getTempFile('foo', 123)));
     $this->assertStringStartsWith($tempDir, realpath(dirname($config->getPipe('pipe', 123))));
     $this->assertStringStartsWith($tempDir, realpath($config->getTempDir()));
     $this->assertEquals(function_exists('readline'), $config->useReadline());
     $this->assertFalse($config->usePcntl());
 }
 public function testLoadConfigFile()
 {
     $config = new Configuration(array('configFile' => __DIR__ . '/../../fixtures/config.php'));
     $runtimeDir = $this->joinPath(realpath(sys_get_temp_dir()), 'psysh_test', 'withconfig', 'temp');
     $this->assertStringStartsWith($runtimeDir, realpath($config->getTempFile('foo', 123)));
     $this->assertStringStartsWith($runtimeDir, realpath(dirname($config->getPipe('pipe', 123))));
     // This will be deprecated, but we want to actually test the value.
     $was = error_reporting(error_reporting() & ~E_USER_DEPRECATED);
     $this->assertStringStartsWith($runtimeDir, realpath($config->getTempDir()));
     error_reporting($was);
     $this->assertStringStartsWith($runtimeDir, realpath($config->getRuntimeDir()));
     $this->assertEquals(function_exists('readline'), $config->useReadline());
     $this->assertFalse($config->usePcntl());
 }
 public function testLoadLocalConfigFile()
 {
     $oldPwd = getenv('PWD');
     putenv('PWD=' . realpath(__DIR__ . '/../../fixtures/project/'));
     $config = new Configuration();
     // When no configuration file is specified local project config is merged
     $this->assertFalse($config->useReadline());
     $this->assertTrue($config->usePcntl());
     $config = new Configuration(array('configFile' => __DIR__ . '/../../fixtures/config.php'));
     // Defining a configuration file skips loading local project config
     $this->assertTrue($config->useReadline());
     $this->assertFalse($config->usePcntl());
     putenv("PWD={$oldPwd}");
 }