src/TestCase.php
/**
     * Runs the test case.
     *
     * @since 1.0.0
     *
     * @param HttpClientInterface $httpClient The HTTP client.
     * @param callable|null       $callback   An optional callback method to call after each assert. The method takes a AssertResultInterface as a parameter.
     *
     * @return TestCaseResultInterface The result.
     */
Runs the test case.

@param HttpClientInterface $httpClient The HTTP client.
@param callable|null       $callback   An optional callback method to call after each assert. The method takes a AssertResultInterface as a parameter.

@return TestCaseResultInterface The result.
Runs the test case . @param HttpClientInterface $httpClient The HTTP client . @param callable|null $callback An optional callback method to call after each assert . The method takes a AssertResultInterface as a parameter . @return TestCaseResultInterface The result .
public function run(HttpClientInterface $httpClient, ?callable $callback = null): TestCaseResultInterface
    {
        $httpClientRequest = new HttpClientRequest($this->url);
        $httpClientResponse = $httpClient->send($httpClientRequest);
        $pageResult = new PageResult(
            $httpClientResponse->getHttpCode(),
            $httpClientResponse->getHeaders(),
            $httpClientResponse->getContent()
        );
        foreach ($this->getAsserts() as $assert) {
            $assertResult = $assert->test($pageResult);
            if ($callback !== null) {
                $callback($assertResult);
            }
            if (!$assertResult->isSuccess()) {
                return new TestCaseResult($this, $assertResult);
            }
        }
        return new TestCaseResult($this);
    }
public function run ( HttpClientInterface $ httpClient , ? callable $ callback = null ) : TestCaseResultInterface { $ httpClientRequest = new HttpClientRequest ( $ this -> url ) ; $ httpClientResponse = $ httpClient -> send ( $ httpClientRequest ) ; $ pageResult = new PageResult ( $ httpClientResponse -> getHttpCode ( ) , $ httpClientResponse -> getHeaders ( ) , $ httpClientResponse -> getContent ( ) ) ; foreach ( $ this -> getAsserts ( ) as $ assert ) { $ assertResult = $ assert -> test ( $ pageResult ) ; if ( $ callback !== null ) { $ callback ( $ assertResult ) ; } if ( ! $ assertResult -> isSuccess ( ) ) { return new TestCaseResult ( $ this , $ assertResult ) ; } } return new TestCaseResult ( $ this ) ; }
Runs the test case.
Runs the test case .