Ejemplo n.º 1
0
 public function setUp()
 {
     Annotations::setConfig(__DIR__ . '/../Mocks/MockAnnotationsConfig.yaml');
     Rest::setConfig(__DIR__ . '/../Mocks/MockRestConfig.yaml');
     // we need to create the cache files so we can test the router
     $parser = new Parser();
     $parserApi = $parser->parseApi('Webiny\\Component\\Rest\\Tests\\Mocks\\MockApiClassRouter', true);
     self::$cache = new Cache(new ArrayDriver());
     $instance = new Compiler('ExampleApi', true, self::$cache);
     $instance->writeCacheFiles($parserApi);
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     Annotations::setConfig(__DIR__ . '/../Mocks/MockAnnotationsConfig.yaml');
     Cache::setConfig(__DIR__ . '/../Mocks/MockCacheConfig.yaml');
     Rest::setConfig(__DIR__ . '/../Mocks/MockRestConfig.yaml');
 }
Ejemplo n.º 3
0
 public function setUp()
 {
     Rest::setConfig(__DIR__ . '/Mocks/MockRestConfig.yaml');
 }
Ejemplo n.º 4
0
require_once './bootstrap.php';
// cors
header("Access-Control-Allow-Origin: *");
// define the login service class
class Login extends \Webiny\Login\LoginServices
{
    private static $login;
    public static function setLoginInstance(\Webiny\Login\Login $login)
    {
        self::$login = $login;
    }
    /**
     * @return \Webiny\Login\Login
     */
    protected function getLoginInstance()
    {
        return self::$login;
    }
}
Login::setLoginInstance($login);
// load rest
\Webiny\Component\Rest\Rest::setConfig('./restConfig.yaml');
try {
    $rest = \Webiny\Component\Rest\Rest::initRest('LoginApi');
    if ($rest) {
        $rest->processRequest()->sendOutput();
    }
} catch (RestException $e) {
    // handle the exception
    die(print_r($e));
}