protected function initialiseDefaultValues() { parent::initialiseDefaultValues(); $request = Context::currentRequest(); $host = $request->Server("SERVER_NAME"); $this->DefaultSender = new EmailAddress("donotreply@" . $host . ".com"); }
public function testPayload() { $testPayload = new \stdClass(); $testPayload->a = 1; $testPayload->b = 2; $this->context->SimulatedRequestBody = json_encode($testPayload); $request = Context::currentRequest(); $this->assertEquals($testPayload, $request->getPayload()); }
* See the License for the specific language governing permissions and * limitations under the License. */ /** * execute-http.php is the entry point for all HTTP requests for Rhubarb applications. * The only exceptions to this are when webserver URL rewriting goes directly to * a resource for performance reasons, e.g. accessing static content like images * and CSS files. */ use Rhubarb\Crown\Logging\Log; use Rhubarb\Crown\Module; // Change the working directory to the top level project folder. chdir(__DIR__ . "/../../../../"); // Initiate our bootstrap script to boot all libraries required. require_once __DIR__ . "/boot.php"; require_once __DIR__ . "/../src/Module.php"; require_once __DIR__ . "/../src/Context.php"; $request = \Rhubarb\Crown\Context::currentRequest(); try { // Pass control to the Module class and ask it to generate a response for the // incoming request. $response = Module::generateResponseForRequest($request); $response->send(); } catch (\Exception $er) { $context = new \Rhubarb\Crown\Context(); if ($context->DeveloperMode) { Log::error($er->getMessage(), "ERROR"); print "<pre>Exception: " . get_class($er) . "\nMessage: " . $er->getMessage() . "\nStack Trace:\n" . $er->getTraceAsString(); } } Log::debug("Request Complete", "ROUTER");
protected function getAbsoluteHandledUrl() { $request = Context::currentRequest(); return $request->Server("REQUEST_SCHEME") . "://" . $request->Server("SERVER_NAME") . $this->handledUrl; }
public function setUp() { $this->request = Context::currentRequest(); $this->request->IsWebRequest = true; }