Scalr\Tests\Api\Rest\Routing\RouteTest::setMiddleware PHP Method

setMiddleware() public method

public setMiddleware ( )
    public function setMiddleware()
    {
        $route = $this->getRouteFixture();
        $route->setMiddleware(['strrev', 'crc32']);
        $arr = $route->getMidleware();
        $this->assertContains('strrev', $arr);
        $this->assertContains('crc32', $arr);
        foreach (['this-is-not-callable', ['not-callable-arr']] as $arg) {
            try {
                $route->addMiddleware($arg);
                $this->assertTrue(false, 'InvalidArgumentException must be thrown here.');
            } catch (\InvalidArgumentException $e) {
                $this->assertTrue(true);
            }
        }
    }