Beispiel #1
0
 /**
  * @param bool $enabled
  */
 protected function setDebugMode($enabled)
 {
     $configValues = ConfigHelper::getDummyConfig();
     $configValues['DEBUG'] = $enabled ? 1 : 0;
     ConfigHelper::setEnvironmentVariables($configValues);
     ConfigHelper::unsetConfigInstance();
 }
Beispiel #2
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Custom configuration options can be set only before the Config object was instantiated
  */
 public function testShouldFailIfSettingCustomConfigurationOptionsAfterFirstInstantiation()
 {
     ConfigHelper::setEnvironmentVariables($this->environmentVariables);
     $provider = ConfigProvider::getInstance();
     // Create Config instance
     $provider->getConfig();
     // This should fail, as the Config instance was already created
     $provider->setCustomConfigurationOptions(['CUSTOM_OPTION']);
 }
 public function testShouldNotLogDebugMessagesIfDebugModeIsNotEnabled()
 {
     $configValues = ConfigHelper::getDummyConfig();
     $configValues['DEBUG'] = 0;
     ConfigHelper::setEnvironmentVariables($configValues);
     ConfigHelper::unsetConfigInstance();
     $this->expectOutputRegex('/^((?!\\[DEBUG\\]).)*$/');
     // Output containing [DEBUG] should not be present
     $this->component->debug('Foo %s', 'bar');
 }
Beispiel #4
0
 public function testShouldNotDumpDataIfDebugModeIsNotEnabled()
 {
     // disable debug mode
     $configValues = ConfigHelper::getDummyConfig();
     $configValues['DEBUG'] = 0;
     ConfigHelper::setEnvironmentVariables($configValues);
     ConfigHelper::unsetConfigInstance();
     $object = new StringableObject('foobar string');
     $legacy = new Legacy($this->testCase);
     $legacy->setFileDir(sys_get_temp_dir());
     $legacy->saveWithName($object, 'object');
     $this->expectOutputRegex('/^((?!foobar string).)*$/s');
     // Output should not contain the string
 }
Beispiel #5
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Directory "/notexisting" does not exist or is not writeable.
  */
 public function testShouldFailIfGivenDirectoryDoesNotExists()
 {
     $configValues = ConfigHelper::getDummyConfig();
     $configValues['LOGS_DIR'] = '/notexisting';
     ConfigHelper::setEnvironmentVariables($configValues);
     ConfigHelper::unsetConfigInstance();
     $publisher = new XmlPublisher(null, null, null);
     $publisher->publishResult('testCaseNameFoo', 'testNameBar', 'started');
 }