示例#1
0
 /**
  * @param bool $enabled
  */
 protected function setDebugMode($enabled)
 {
     $configValues = ConfigHelper::getDummyConfig();
     $configValues['DEBUG'] = $enabled ? 1 : 0;
     ConfigHelper::setEnvironmentVariables($configValues);
     ConfigHelper::unsetConfigInstance();
 }
示例#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']);
 }
示例#3
0
 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');
 }
示例#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
 }
示例#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');
 }