public function handleRequest() { ini_set('display_errors', '0'); $as = new \FutoIn\RI\ScopedSteps(); $as->add(function ($as) { $reqinfo = $this->getBaseRequestInfo($as); $this->configureRequestInfo($as, $reqinfo); $as->reqinfo = $reqinfo; $this->process($as); $as->add(function ($as) { $reqinfo = $as->reqinfo; $reqinfo_info = $reqinfo->info(); if (!is_null($reqinfo_info->{RequestInfo::INFO_RAW_RESPONSE})) { header('Content-Type: application/futoin+json'); echo $reqinfo_info->{RequestInfo::INFO_RAW_RESPONSE}; } if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); } $as->success(); }); }, function ($as, $err) { error_log("{$err}: " . $as->error_info); http_response_code(500); header('Content-Type: application/futoin+json'); echo '{"e":"InvalidRequest"}'; }); $as->run(); }
public function testScopedStepsInit() { $val =& AsyncToolTest::getEvents(); $val = null; $as = new \FutoIn\RI\ScopedSteps(); $as->run(); $this->assertTrue(is_array(AsyncToolTest::getEvents())); }
<?php use FutoIn\RI\Invoker\AdvancedCCM; use FutoIn\RI\Executor\HTTP\Executor; use FutoIn\RI\Executor\RequestInfo; require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/ExecutorTest_SrvImpl.php'; //-- $specdirs = [__DIR__ . '/../vendor/futoin/core-php-ri-invoker/tests/specs', __DIR__ . '/specs']; //-- $as = new \FutoIn\RI\ScopedSteps(); $ccm = new AdvancedCCM(array('specDirs' => $specdirs)); $executor = new Executor($ccm, array('specDirs' => $specdirs, Executor::OPT_SUBPATH => '/Server_HTTPExecutorTest.php')); $as->add(function ($as) use($executor) { $executor->register($as, 'exec.derived:1.3', new ExecutorTest_SrvImpl($executor)); $executor->register($as, 'exec.secure:1.1', new ExecutorTest_SrvImpl($executor)); $as->successStep(); }, function ($as, $err) { var_dump($err); var_dump($as->error_info); }); $as->run(); //-- $executor->handleRequest();