Expected::exactly should have ability to change callback method per times called
まだ誰も着手していません。
評価
調査の方向性
まず Codeception Stub リポジトリ内で Expected::exactly の実装箇所を見つけ、現在コールバックの呼び出しがどのように処理されているかを確認します。issue にある 2 つのコールバックの例を受け入れ条件として使用してください。連続する呼び出しでは異なる応答を受け取る必要があり、コールバックは返却前にアサーションを実行できる必要があります。
索引モデルが issue の本文から書いたものです。
説明
What are you trying to achieve?
Http client send method is called 2 times on a test
I would like to make different response objects for each of them
on one of them I would also like to have asserts
What do you get instead?
RN it is impossible to have different callbacks for consecutive calls
Provide console output if related. Use
-vvvmode for more details.
Provide test source code if related
$oauth2Provider->setHttpClient($this->construct(Client::class, [], [
'send' => Expected::exactly(2,
function (RequestInterface $request) {
return new Response(200, [
'content-type' => 'application/json'
], '{"access_token": "access", "expires_in": 3600, "refresh_token": "refresh"}');
},
function (RequestInterface $request) {
//assertions go here
return new Response(200, [
], 'response body goes here');
}
]))
]));
Details
- Codeception version:
- PHP Version: 7.4.6
- Operating System: Ubuntu
- Installation type: Composer
- List of installed packages (
composer show) - Suite configuration:
# paste suite config here
Addittional info
RN I do this
$oauth2Provider->setHttpClient($this->construct(Client::class, [], [
'send' => Expected::exactly(2, Closure::fromCallable(new MultiCallable([
function (RequestInterface $request) {
return new Response(200, [
'content-type' => 'application/json'
], '{"access_token": "access", "expires_in": 3600, "refresh_token": "refresh"}');
},
function (RequestInterface $request) {
//asserts go here
return new Response(200, [
], 'response body goes here');
}
])))
]));
<?php
class MultiCallable
{
private $methods;
public function __construct($methods)
{
$this->methods = $methods;
}
public function __invoke(...$args)
{
$method = array_shift($this->methods);
return call_user_func_array($method, $args);
}
}
- 主要言語
- PHP
- スター
- 301
- フォーク
- 19
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Codeception/Stub のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
Codeception/Stub#61 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
Codeception/Stub#45 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
Codeception/Stub#36 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
Codeception/Stub#7 · リアクション 5 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 48/100
Codeception/Stub#31 · コメント 3 件 ·
Codeception/Stub の issue をすべて見る
似ている issue
-
status/awaiting_triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
WordPress/plugin-check#1486 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
az-digital/az_quickstart#6019 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
grokability/snipe-it#19688 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100