Skip to content

Commit 93673c8

Browse files
committed
Updates AbstractTest to load env variables.
1 parent 560eeb0 commit 93673c8

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/AbstractTest.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,34 @@ public function setUp(): void
2626
}
2727

2828
// Next check each individual one
29-
if (! isset($_ENV['AUTOTASK_API_USERNAME'])) {
29+
$username = getenv('AUTOTASK_API_USERNAME');
30+
$secret = getenv('AUTOTASK_API_SECRET');
31+
$ic = getenv('AUTOTASK_API_INTEGRATION_CODE');
32+
$baseUri = getenv('AUTOTASK_API_BASE_URI');
33+
34+
// Next check each individual one
35+
if (! $username) {
3036
throw new Exception('Unable to find find AUTOTASK_API_USERNAME env variable!');
3137
}
3238

33-
if (! isset($_ENV['AUTOTASK_API_SECRET'])) {
39+
if (! $secret) {
3440
throw new Exception('Unable to find find AUTOTASK_API_SECRET env variable!');
3541
}
3642

37-
if (! isset($_ENV['AUTOTASK_API_INTEGRATION_CODE'])) {
43+
if (! $ic) {
3844
throw new Exception('Unable to find find AUTOTASK_API_INTEGRATION_CODE env variable!');
3945
}
4046

41-
if (! isset($_ENV['AUTOTASK_API_BASE_URI'])) {
47+
if (! $baseUri) {
4248
throw new Exception('Unable to find find AUTOTASK_API_BASE_URI env variable!');
4349
}
4450

4551
// Now try creating the client
4652
$this->client = new Client(
47-
$_ENV['AUTOTASK_API_USERNAME'],
48-
$_ENV['AUTOTASK_API_SECRET'],
49-
$_ENV['AUTOTASK_API_INTEGRATION_CODE'],
50-
$_ENV['AUTOTASK_API_BASE_URI']
53+
$username,
54+
$secret,
55+
$ic,
56+
$baseUri
5157
);
5258
}
5359
}

0 commit comments

Comments
 (0)