@@ -291,6 +291,11 @@ public function operationDo($operation, $lastOperationResult, &$context, $testNa
291
291
self ::markTestIncomplete (sprintf ('Method "%s" not implement in "%s" ' , $ method , get_class ($ caller )));
292
292
}
293
293
294
+ // TODO remove this after cat testing situation resolved
295
+ if ($ caller instanceof Elasticsearch \Namespaces \CatNamespace) {
296
+ $ endpointParams ->format = 'text ' ;
297
+ }
298
+
294
299
// Exist* methods have to be manually 'unwrapped' into true/false for async
295
300
if (strpos ($ method , "exist " ) !== false && $ async === true ) {
296
301
return $ this ->executeAsyncExistRequest ($ caller , $ method , $ endpointParams , $ expectedError , $ expectedWarnings , $ testName );
@@ -384,32 +389,31 @@ public function checkForWarnings($expectedWarnings) {
384
389
$ last = $ this ->client ->transport ->getLastConnection ()->getLastRequestInfo ();
385
390
386
391
387
- // We have some warnings to check
388
- if ($ expectedWarnings !== null ) {
389
- if (isset ($ last ['response ' ]['headers ' ]['Warning ' ]) === true ) {
390
- foreach ($ last ['response ' ]['headers ' ]['Warning ' ] as $ warning ) {
391
- $ position = array_search ($ warning , $ expectedWarnings );
392
- if ($ position !== false ) {
393
- // found the warning
394
- unset($ expectedWarnings [$ position ]);
395
- } else {
396
- // didn't find, throw error
397
- //throw new \Exception("Expected to find warning [$warning] but did not.");
398
- }
399
- }
400
- if (count ($ expectedWarnings ) > 0 ) {
401
- throw new \Exception ("Expected to find more warnings: " . print_r ($ expectedWarnings , true ));
392
+ // We have some warnings to check
393
+ if ($ expectedWarnings !== null ) {
394
+ if (isset ($ last ['response ' ]['headers ' ]['Warning ' ]) === true ) {
395
+ foreach ($ last ['response ' ]['headers ' ]['Warning ' ] as $ warning ) {
396
+ $ position = array_search ($ warning , $ expectedWarnings );
397
+ if ($ position !== false ) {
398
+ // found the warning
399
+ unset($ expectedWarnings [$ position ]);
400
+ } else {
401
+ // didn't find, throw error
402
+ //throw new \Exception("Expected to find warning [$warning] but did not.");
402
403
}
403
404
}
404
- }
405
- /* else {
406
- // no expected warnings, make sure we have none returned
407
- if (isset($last['response']['headers']['Warning']) === true) {
408
- throw new \Exception("Did not expect to find warnings, found some instead: "
409
- . print_r($last['response']['headers']['Warning'], true));
405
+ if (count ($ expectedWarnings ) > 0 ) {
406
+ throw new \Exception ("Expected to find more warnings: " . print_r ($ expectedWarnings , true ));
410
407
}
411
408
}
412
- */
409
+ }
410
+
411
+ // Check to make sure we're adding headers
412
+ static ::assertArrayHasKey ('Content-type ' , $ last ['request ' ]['headers ' ], print_r ($ last ['request ' ]['headers ' ], true ));
413
+ static ::assertEquals ('application/json ' , $ last ['request ' ]['headers ' ]['Content-type ' ][0 ], print_r ($ last ['request ' ]['headers ' ], true ));
414
+ static ::assertArrayHasKey ('Accept ' , $ last ['request ' ]['headers ' ], print_r ($ last ['request ' ]['headers ' ], true ));
415
+ static ::assertEquals ('application/json ' , $ last ['request ' ]['headers ' ]['Accept ' ][0 ], print_r ($ last ['request ' ]['headers ' ], true ));
416
+
413
417
}
414
418
415
419
/**
0 commit comments