Skip to content

Conversation

Kolyunya
Copy link
Contributor

@Kolyunya Kolyunya commented Apr 2, 2021

Added a send() method which accepts a $method argument as a sting.

I didn't make the execute() method public in order to keep the naming consistent with the rest of the send...() methods.
A also didn't rename execute() to preserve backward compatibility which will be lost otherwise.

A use-case would be to pass a request method in a data provider:

/**
 * @dataProvider provider
 */
public function test(ApiTester $I, Example $example): void
{
    $uri = 'https://example.tld/endpoint';
    $method = $example['method'];
    $data = $example['data'];

    $I->send($method, $uri, $data);
    $I->seeResponseCodeIs($example['status-code']);
}

private function provider(): array
{
    return [
        [
            'method' => 'PUT',
            'data' => [
                'foo' => 'bar',
            ],
            'status-code' => HttpCode::OK,
        ],
        [
            'method' => 'PATCH',
            'data' => [
                'foo' => 'bar',
            ],
            'status-code' => HttpCode::OK,
        ],
    ];    
}

@Naktibalda Naktibalda requested a review from DavertMik April 5, 2021 09:10
@Naktibalda Naktibalda merged commit fd6e608 into Codeception:master Apr 5, 2021
@Naktibalda
Copy link
Member

Released as 1.3.0

@Kolyunya
Copy link
Contributor Author

Kolyunya commented Apr 8, 2021

@Naktibalda thanks for a quick release guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants