<?php
namespace ccxt;

// ----------------------------------------------------------------------------

// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

// -----------------------------------------------------------------------------
use React\Async;
use React\Promise;
include_once PATH_TO_CCXT . '/test/exchange/base/test_order_book.php';
include_once PATH_TO_CCXT . '/test/exchange/base/test_shared_methods.php';

function test_watch_order_book_for_symbols($exchange, $skipped_properties, $symbols) {
    return Async\async(function () use ($exchange, $skipped_properties, $symbols) {
        $method = 'watchOrderBookForSymbols';
        $now = $exchange->milliseconds();
        $ends = $now + 15000;
        while ($now < $ends) {
            $response = null;
            $success = true;
            try {
                $response = Async\await($exchange->watch_order_book_for_symbols($symbols));
            } catch(\Throwable $e) {
                // temporary fix for InvalidNonce for c#
                if (!is_temporary_failure($e) && !($e instanceof InvalidNonce)) {
                    throw $e;
                }
                $now = $exchange->milliseconds();
                // continue;
                $success = false;
            }
            if ($success === true) {
                // [ response, skippedProperties ] = fixPhpObjectArray (exchange, response, skippedProperties);
                assert(is_array($response), $exchange->id . ' ' . $method . ' ' . $exchange->json($symbols) . ' must return an object. ' . $exchange->json($response));
                $now = $exchange->milliseconds();
                assert_in_array($exchange, $skipped_properties, $method, $response, 'symbol', $symbols);
                test_order_book($exchange, $skipped_properties, $method, $response, null);
            }
        }
        return true;
    }) ();
}
