protected function createApp($callback = null) { $app = new Application(['root' => '.', 'services' => ['log' => $this->createLogger($this->logFile)]]); if ($callback) { $app->route('GET', '/', $callback); } $app->bootstrap(); return $app; }
protected function createApplication() { $application = new Application(['root' => '.']); $application->route('GET', '/', function () { return 'hello'; })->route('GET', '/{a}/plus/{b}', function ($a, $b, Request $request) { return $a + $b; })->route('GET', '/{a}/multi/{b}', 'blink\\tests\\http\\TestController@compute')->bootstrap(); return $application; }
public function createApplication() { $application = new Application(['root' => '.']); $application->route('POST', '/files', function (Request $request, Response $response) { $response->headers->with('Content-Type', 'application/json'); $file = $request->files->first('foo'); return ['name' => $file->name, 'size' => $file->size]; })->route('GET', '/', function (Request $request, Response $response) { return 'Hello, Blink!'; })->route('GET', '/json', function (Request $request, Response $response) { return ['name' => 'Blink', 'ext' => 'swoole', 'dev' => 'test']; })->route('GET', '/json_contains', function (Request $request, Response $response) { return ['status' => 'ok', 'data' => ["name" => 'blink', "ext" => 'swoole']]; })->bootstrap(); return $this->app = $application; }
public function __construct(\PHPUnit_Framework_TestCase $phpunit, Application $app) { $this->phpunit = $phpunit; $this->app = $app; $this->request = $app->makeRequest(); }