* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once __DIR__ . '/../bootstrap.php'; use Sabre\Katana\Server\Installer; use Sabre\Katana\Server\Server; use Sabre\HTTP; /** * This file is the first to receive the HTTP request and runs the server. * * @copyright Copyright (C) 2015 fruux GmbH (https://fruux.com/). * @author Ivan Enderlin * @license GNU Affero General Public License, Version 3. */ /** * If the applications has not already been installed, redirect to install.php. */ if (false === Installer::isInstalled()) { $request = HTTP\Sapi::getRequest(); $response = new HTTP\Response(); Installer::redirectToInstall($response, $request); HTTP\Sapi::sendResponse($response); return; } $server = new Server(); $server->run();
/** * @tags installation http */ function case_redirect_to_install() { $this->given($request = new HTTP\Request(null, '/mybase/foo'), $response = new HTTP\Response())->when($result = CUT::redirectToInstall($response, $request))->then->variable($result)->isNull()->object($response)->integer($response->getStatus())->isEqualTo(307)->string($response->getHeader('Location'))->isEqualTo('/mybase/install.php')->string($response->getBody())->isNotEmpty(); }