TestResponse example

// Make sure validation is reset between tests         Services::injectMock('validation', Services::validation(null, false));

        $response = $this->app
            ->setContext('web')
            ->setRequest($request)
            ->run($routes, true);

        // Reset directory if it has been set         Services::router()->setDirectory(null);

        return new TestResponse($response);
    }

    /** * Performs a GET request. * * @param string $path URI path relative to baseURL. May include query. * * @return TestResponse * * @throws RedirectException * @throws Exception */
        else {
            // getStatusCode() throws for empty codes             try {
                $response->getStatusCode();
            } catch (HTTPException $e) {
                // If no code has been set then assume success                 $response->setStatusCode(200);
            }
        }

        // Create the result and add the Request for reference         return (new TestResponse($response))->setRequest($this->request);
    }

    /** * Set controller's config, with method chaining. * * @param mixed $appConfig * * @return $this */
    public function withConfig($appConfig)
    {
        
Home | Imprint | This part of the site doesn't use cookies.