protected function initialiseDefaultValues()
 {
     parent::initialiseDefaultValues();
     $request = Context::currentRequest();
     $host = $request->Server("SERVER_NAME");
     $this->DefaultSender = new EmailAddress("donotreply@" . $host . ".com");
 }
Beispiel #2
0
 protected function initialiseDefaultValues()
 {
     parent::initialiseDefaultValues();
     $request = Application::current()->request();
     $host = $request->server("SERVER_NAME");
     $this->defaultSender = new EmailRecipient("donotreply@" . $host . ".com");
 }
Beispiel #3
0
 protected function initialiseDefaultValues()
 {
     global $unitTesting;
     parent::initialiseDefaultValues();
     // $unitTesting is set in execute-test.php
     $this->UnitTesting = isset($unitTesting) && $unitTesting ? true : false;
     $this->DeveloperMode = false;
     $this->Live = false;
 }
 public function testSessionRestore()
 {
     $session = new UnitTestingSession();
     $session->TestValue = "abc123";
     $session->storeSession();
     // We can't test PHP sessions properly within the same script. However we can verify
     // that it at least restores the data from the $_SESSION array
     Settings::deleteSettingNamespace("UnitTestingSession");
     $session = new UnitTestingSession();
     $this->assertEquals("abc123", $session->TestValue);
 }
 public function testValuesCanBeAccessedStatically()
 {
     $settings = new UnitTestingSettings();
     $settings->Foo = "abc";
     $this->assertEquals("abc", Settings::getSetting('UnitTesting', "Foo"));
     // No exception thrown as a default is supplied.
     $return = Settings::getSetting('UnitTesting', "Bar", "123");
     $this->assertEquals("123", $return);
     $this->setExpectedException("\\Rhubarb\\Crown\\Exceptions\\SettingMissingException");
     Settings::getSetting('UnitTesting', "Bar");
 }
 protected function initialiseDefaultValues()
 {
     parent::initialiseDefaultValues();
     $this->Port = 3306;
 }
Beispiel #7
0
 /**
  * Leverages the base method from Settings to restore the session.
  */
 protected function initialiseDefaultValues()
 {
     $provider = $this->getSessionProvider();
     $provider->restoreSession($this);
     parent::initialiseDefaultValues();
 }
 protected function initialiseDefaultValues()
 {
     parent::initialiseDefaultValues();
     $this->SettingWithDefault = "default";
 }
Beispiel #9
0
 /**
  * Magic setter, guarding against attempts to set Original... properties.
  *
  * @param string $propertyName
  * @param mixed $value
  */
 public function __set($propertyName, $value)
 {
     if (substr($propertyName, 0, 8) === 'Original') {
         throw new AttemptToModifyReadOnlyPropertyException("Attempt to modify Original Data of a request");
     }
     parent::__set($propertyName, $value);
 }