seeResponseMatchesJsonType issue on multiple arrays of arrays

オープン
#91 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
api, testing

調査の方向性

seeResponseMatchesJsonType エントリポイントから始め、説明されている複数のネストされた配列を使って tests/api/testCest.php:suspendedVenues の失敗を再現します。JSONPath '$..businessHours[i]' の結果がどのようにチェックされるかを追跡します。ネストされた配列内の有効な営業時間オブジェクトがキー欠落エラーを生成しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

What are you trying to achieve?

Trying to use seeResponseMatchesJsonType on a response from multiple arrays of arrays

What do you get instead?

After several iterations I get an error

1) testCest: Test Get the SUSPENDED Venues!
 Test  tests/api/testCest.php:suspendedVenues
 Step  See response matches json type {"businessHourID":"integer","workingDay":"string","specialHourDate":"string|null","fromTime":"string|null","toTime":"string|null","isClosed":"boolean"},"$..businessHours[22]"
 Fail  Key `businessHourID` doesn't exist in []

Provide test source code if related
The code I use is

// businessHours array from the venue payload
    public static $businessHoursArrayResponse = [
        'businessHourID'  => 'integer',
        'workingDay'      => 'string',
        'specialHourDate' => 'string|null',
        'fromTime'        => 'string|null',
        'toTime'          => 'string|null',
        'isClosed'        => 'boolean'
    ];
...
$businessHoursArray = $I->grabDataFromResponseByJsonPath('$..businessHours.*');
        for ($i=0; $i < count($businessHoursArray); $i++){
            if (!empty($businessHoursArray[$i])) {
                $I->seeResponseMatchesJsonType(self::$businessHoursArrayResponse, '$..businessHours['.$i.']');
            }
        }

var_dump($businessHoursArray) prints an array of 53 valid arrays no missing keys or anything.

Details
  • Codeception version: v4.1.20
  • PHP Version: 7.2.24
  • Operating System: Ubuntu
  • Installation type: Phar
  • List of installed packages (composer show)
  • Suite configuration:
actor: ApiTester
modules:
  enabled:
    - Asserts
    - Helper\Api
    - REST:
        depends: PhpBrowser
        url: '****'
        part: Json
        curl:
          CURLOPT_RETURNTRANSFER: true
主要言語
PHP
スター
60
フォーク
30
平均マージ
22時間 37分
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Codeception/module-rest のほかの issue

Codeception/module-rest の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。