Example #1
0
<?php

use BeMyGuest\SdkClient\Client;
use BeMyGuest\SdkClient\Response;
use Illuminate\Support\Collection;
use BeMyGuestAPIV1Lib\Configuration;
describe('BeMyGuest API Client package - integration', function () {
    given('client', function () {
        Configuration::$BASEURI = 'https://apidemo.bemyguest.com.sg';
        return new Client('2c9971eac77c0b7b1a43b5263c3eff15aae58284');
    });
    after(function () {
        foreach ($this->bookings as $uuid) {
            $this->client->cancelBooking($uuid);
        }
    });
    $this->bookings = [];
    describe('Client', function () {
        it('filters bookings by status', function () {
            $first = $this->client->createBooking(sampleBookingData());
            $this->client->confirmBooking($first->uuid);
            $second = $this->client->createBooking(sampleBookingData());
            $this->client->confirmBooking($second->uuid);
            $response = $this->client->getWaitingBookings(['per_page' => 1000])->keyBy('uuid');
            expect($response->has($first->uuid))->toBeTruthy();
            expect($response->has($second->uuid))->toBeTruthy();
            $this->bookings[] = $first->uuid;
            $this->bookings[] = $second->uuid;
        });
        it('confirms a booking given uuid and sets its state to "waiting for approval"', function () {
            $booking = $this->client->createBooking(sampleBookingData());