Skip to content

Commit 503eae6

Browse files
committed
test(reporting): source live token from TEST_SQUARE_REPORTING (prod)
1 parent 225dab0 commit 503eae6

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
env:
3333
TEST_SQUARE_TOKEN: ${{ secrets.TEST_SQUARE_TOKEN }}
34+
TEST_SQUARE_REPORTING: ${{ secrets.TEST_SQUARE_REPORTING }}
3435

3536
steps:
3637
- name: Checkout repo

tests/Integration/ReportingTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Square\Tests\Integration;
44

55
use PHPUnit\Framework\TestCase;
6-
use RuntimeException;
76
use Square\Environments;
87
use Square\Reporting\Requests\LoadRequest;
98
use Square\SquareClient;
@@ -18,23 +17,20 @@
1817
* The Reporting API is **production only** — it is not available in sandbox
1918
* (sandbox host → 404, sandbox token against production → 401) — and requires a
2019
* reporting-provisioned token. To avoid breaking the default CI run, the whole
21-
* suite is skipped unless `TEST_SQUARE_REPORTING` is set. When enabled it reuses
22-
* the same `TEST_SQUARE_TOKEN` as the other integration tests, but points at the
23-
* production environment.
20+
* suite is skipped unless `TEST_SQUARE_REPORTING` is set. When enabled,
21+
* `TEST_SQUARE_REPORTING` itself supplies the production reporting-provisioned
22+
* access token used to authenticate against the production environment
23+
* (`TEST_SQUARE_REPORTING=<prod-reporting-token>`).
2424
*/
2525
class ReportingTest extends TestCase
2626
{
2727
private static SquareClient $client;
2828

2929
public static function setUpBeforeClass(): void
3030
{
31-
if (!getenv('TEST_SQUARE_REPORTING')) {
32-
self::markTestSkipped('Set TEST_SQUARE_REPORTING (with a production reporting token in TEST_SQUARE_TOKEN) to run the Reporting API live tests.');
33-
}
34-
35-
$token = getenv('TEST_SQUARE_TOKEN');
31+
$token = getenv('TEST_SQUARE_REPORTING');
3632
if (!$token) {
37-
throw new RuntimeException('TEST_SQUARE_TOKEN environment variable is not set.');
33+
self::markTestSkipped('Set TEST_SQUARE_REPORTING=<prod-reporting-token> to run the Reporting API live tests against production.');
3834
}
3935

4036
self::$client = new SquareClient(

0 commit comments

Comments
 (0)