public function testExecuteReturnsMethodOutputValue()
 {
     /**
      * @var PhakeLeController $result
      */
     $this->setLeQuestForTestMethod();
     $this->setExecuteController();
     $result = $this->execute->execute('Tests\\guidaMedia\\Leroy\\LeCore\\PhakeLeController', 'test');
     $this->assertEquals('Made it', $result);
 }
Exemple #2
0
 * @var Exception $e
 * @var LeEnvironment $env
 *
 * @todo the name of the log should be grab from config
 */
try {
    $request = new LeQuest(new LeServerModel(new LeValidator()));
    $request->initialize($_POST, $_GET, $_SERVER);
    unset($_REQUEST);
    unset($_GET);
    unset($_POST);
    $controller = $request->get('c');
    $method = $request->get('m');
    $request->remove('c');
    $request->remove('m');
    $execute = new LeExecuteController($request);
    echo $execute->execute($controller, $method);
} catch (Exception $e) {
    $env = new LeEnvironment();
    if ($env->isDevMode()) {
        print_r($e);
    } else {
        $log = new LeLog(__FILE__);
        $context = [];
        if (!is_null($request) && $request instanceof LeQuestInterface) {
            $context = $request->get();
            if (!is_array($context)) {
                $context = [$context];
            }
        }
        $log->critical($e->getMessage(), $context);