Is it possible to type-check the root?
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- php
- 領域
- api, testing-qa
調査の方向性
まず JsonType チェッカーと既存の REST レスポンスアサーションを読みます。ルートがインデックス付き配列であるレスポンスを対象に、提案されているエントリポイント seeJsonResponseLengthIs(int $number) を定義し、レスポンス要素数を検証し、インデックス付き配列ではないルートを拒否することを示すカバレッジを追加します。
索引モデルが issue の本文から書いたものです。
説明
My main intent is to make sure the response contains the number of elements I expect.
My current flow is to grab the json_decoded response and use PHPUnit asserts for that... but it seems suboptimal.
Then I decided to see the JsonType checker, but even by adding a custom filter (for array/string length) it doesn't really help as I can't type-check the actual root as an array - just its entries.
Unfortunately, the API I'm testing doesn't have a root key (i.e. $.data), the list is directly returned (e.g. [ { user_id: x }, { user_id: y } ]).
I see I can't use the JsonType matcher by design, and changing that could be a breaking change, or an extra argument... Doesn't seem the best?
I wonder if this is such an edge case that I should only care to write something on my own, or if I could submit a PR of something like seeJsonResponseLengthIs(int $number). It would check the response is an indexed array, and then count it.
- 主要言語
- PHP
- スター
- 60
- フォーク
- 30
- 平均マージ
- 22時間 37分
- マージ済み PR(30日)
- 1
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Codeception/module-rest のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
Codeception/module-rest#114 · コメント 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
Codeception/module-rest#110 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
Codeception/module-rest#98 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
Codeception/module-rest#79 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
Codeception/module-rest#80 · コメント 2 件 ·
Codeception/module-rest の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
hector-jewell/food-delivery-system-for-restaurant-using-php#1311 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Sylius/SyliusGridBundle#501 ·