Codeception / Codeception/module-rest

seeResponseMatchesJsonType issue on multiple arrays of arrays

Đang mở
#91 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
60
Fork
30
Merge trung bình
22 giờ 37 phút
Pull request đã merge (30 ngày)
1

Mô tả

#### 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

```bash
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
```php
// 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:

```yml
actor: ApiTester
modules:
enabled:
- Asserts
- Helper\Api
- REST:
depends: PhpBrowser
url: '****'
part: Json
curl:
CURLOPT_RETURNTRANSFER: true
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.