/** * Defines and initializes extension points and configuration points. * * @since Method available since Release 0.6.0 */ function _initialize() { $this->_addConfigurationPoint('actionDirectory'); $this->_addConfigurationPoint('enableSingleFlowMode', false); // deprecated $this->_addConfigurationPoint('cacheDirectory'); $this->_addConfigurationPoint('flowDefinitions', array()); // deprecated $this->_addConfigurationPoint('flowExecutionTicketKey', '_flowExecutionTicket'); $this->_addConfigurationPoint('flowNameKey', '_flow'); // deprecated $this->_addConfigurationPoint('flowName'); // deprecated $this->_addConfigurationPoint('bindActionsWithFlowExecution', true); $this->_addConfigurationPoint('enableGC', false); $this->_addConfigurationPoint('gcExpirationTime', 1440); $this->_addConfigurationPoint('useGCFallback', false); $this->_addConfigurationPoint('gcFallbackURL'); // deprecated $this->_addConfigurationPoint('useFlowMappings', false); $this->_addConfigurationPoint('flowMappings', array()); $this->_addConfigurationPoint('configDirectory'); $this->_addConfigurationPoint('configExtension', '.flow'); $this->_addConfigurationPoint('useFullFlowNameAsViewPrefix', true); $this->_addConfigurationPoint('gcFallbackURI', $this->_getConfiguration('gcFallbackURL')); Piece_Unity_Service_Continuation::setFlowExecutionTicketKey($this->_getConfiguration('flowExecutionTicketKey')); $GLOBALS['PIECE_UNITY_Continuation_FlowIDKey'] = $this->_getConfiguration('flowNameKey'); if ($this->_getConfiguration('useFlowMappings')) { $GLOBALS['PIECE_UNITY_Continuation_FlowID'] = $this->_context->getOriginalScriptName(); } else { $GLOBALS['PIECE_UNITY_Continuation_FlowID'] = $this->_getConfiguration('flowName'); } Piece_Flow_Action_Factory::setActionDirectory($this->_getConfiguration('actionDirectory')); $viewElement =& $this->_context->getViewElement(); $viewElement->setElement('__flowExecutionTicketKey', Piece_Unity_Service_Continuation::getFlowExecutionTicketKey()); $viewElement->setElement('__flowNameKey', $GLOBALS['PIECE_UNITY_Continuation_FlowIDKey']); }
/** * Sets the key which represents the flow execution ticket parameter. * * @param string $flowExecutionTicketKey */ public static function setFlowExecutionTicketKey($flowExecutionTicketKey) { self::$_flowExecutionTicketKey = $flowExecutionTicketKey; }
/** * Gets a flow execution ticket. * * @return string */ public function getFlowExecutionTicket() { return $this->context->request->hasParameter(Piece_Unity_Service_Continuation::getFlowExecutionTicketKey()) ? $this->context->request->getParameter(Piece_Unity_Service_Continuation::getFlowExecutionTicketKey()) : null; }
/** * @test * @since Method available since Release 1.5.0 */ public function createAUriObjectBasedOnAGivenPathAndFlowExecutionTicket() { $this->markTestSkipped(); $_SERVER['SERVER_NAME'] = 'example.org'; $_SERVER['SERVER_PORT'] = '80'; $_SERVER['REQUEST_URI'] = '/user/authentication.php'; $this->initializeContext(); $this->addExtension('actionDirectory', $this->exclusiveDirectory); $this->addExtension('configDirectory', $this->exclusiveDirectory); $this->addExtension('cacheDirectory', $this->exclusiveDirectory); $this->addExtension('flowMappings', array(array('uri' => '/entry/new.php', 'flowName' => 'Entry_New', 'isExclusive' => false), array('uri' => '/user/authentication.php', 'flowName' => 'Entry_New', 'isExclusive' => true))); @$this->context->getSession()->start(); $dispatcher = $this->materializeFeature(); $dispatcher->invoke(); $_SERVER['REQUEST_URI'] = '/entry/new.php'; $_GET['_event'] = null; $_GET['_flowExecutionTicket'] = null; $this->initializeContext(); @$this->context->getSession()->start(); $dispatcher = $this->materializeFeature(); $dispatcher->invoke(); $uri1 = $this->context->getAttribute('uri'); $uri2 = Piece_Unity_Service_Continuation::createURI('qux', '/user/authentication.php'); $this->assertType('Piece_Unity_URI', $uri1); $this->assertRegExp('!^http://example\\.org/entry/new\\.php\\?_flowExecutionTicket=[0-9a-f]{40}&_event=baz$!', $uri1->getURI()); $this->assertType('Piece_Unity_URI', $uri2); $this->assertRegExp('!^http://example\\.org/user/authentication\\.php\\?_flowExecutionTicket=[0-9a-f]{40}&_event=qux$!', $uri2->getURI()); $queryVariables1 = $uri1->getQueryVariables(); $queryVariables2 = $uri2->getQueryVariables(); $this->assertNotEquals($queryVariables1['_flowExecutionTicket'], $queryVariables2['_flowExecutionTicket']); }