Skip to content

Commit

Permalink
Add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 18, 2025
1 parent 8272f26 commit 91c06b8
Show file tree
Hide file tree
Showing 23 changed files with 3,573 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/Integration/CashDrawersTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Square\Tests\Integration;

use DateTime;
use DateTimeInterface;
use PHPUnit\Framework\TestCase;
use Square\CashDrawers\Shifts\Requests\ListShiftsRequest;
use Square\Exceptions\SquareApiException;
use Square\Exceptions\SquareException;
use Square\SquareClient;

class CashDrawersTest extends TestCase
{
private static SquareClient $client;

public static function setUpBeforeClass(): void
{
self::$client = Helpers::createClient();
}

/**
* @throws SquareException
* @throws SquareApiException
*/
public function testListCashDrawerShifts(): void
{
$start = (new DateTime('-1 hour'))->format(DateTimeInterface::ATOM);
$end = (new DateTime())->format(DateTimeInterface::ATOM);
$locationId = Helpers::getDefaultLocationId(self::$client);

$request = new ListShiftsRequest([
'locationId' => $locationId,
'beginTime' => $start,
'endTime' => $end,
]);

$response = self::$client->cashDrawers->shifts->list($request);

$this->assertNotNull($response);
iterator_to_array($response);
}
}
Loading

0 comments on commit 91c06b8

Please sign in to comment.