Example #1
0
<?php

use Siphon\Controller;
use Siphon\Exception\NotFoundHttpException;
use Siphon\Exception\HttpException;
describe("Siphon Controller", function () {
    it("returns the controllers services", function () {
        $c = new Controller();
        expect($c->redirect('/route'))->toBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse');
        expect($c->json([]))->toBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse');
        expect(function () use($c) {
            return $c->abort(404);
        })->toThrow(new NotFoundHttpException());
        expect(function () use($c) {
            return $c->abort(405);
        })->toThrow(new HttpException(405));
    });
});