-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathWorkOSTest.php
More file actions
59 lines (45 loc) · 1.56 KB
/
WorkOSTest.php
File metadata and controls
59 lines (45 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace WorkOS;
use PHPUnit\Framework\TestCase;
class WorkOSTest extends TestCase
{
protected function setUp(): void
{
WorkOS::setApiKey(null);
WorkOS::setClientId(null);
putenv("WORKOS_API_KEY=");
putenv("WORKOS_CLIENT_ID=");
unset($_ENV['WORKOS_API_KEY']);
unset($_ENV['WORKOS_CLIENT_ID']);
unset($_SERVER['WORKOS_API_KEY']);
unset($_SERVER['WORKOS_CLIENT_ID']);
}
protected function tearDown(): void
{
WorkOS::setApiKey(null);
WorkOS::setClientId(null);
putenv("WORKOS_API_KEY=");
putenv("WORKOS_CLIENT_ID=");
unset($_ENV['WORKOS_API_KEY']);
unset($_ENV['WORKOS_CLIENT_ID']);
unset($_SERVER['WORKOS_API_KEY']);
unset($_SERVER['WORKOS_CLIENT_ID']);
}
public function testGetApiKeyFromEnvSuperglobal()
{
$_ENV['WORKOS_API_KEY'] = "pk_test_env_superglobal";
$this->assertEquals("pk_test_env_superglobal", WorkOS::getApiKey());
}
public function testGetClientIdFromEnvSuperglobal()
{
$_ENV['WORKOS_CLIENT_ID'] = "client_test_env_superglobal";
$this->assertEquals("client_test_env_superglobal", WorkOS::getClientId());
}
public function testLaravelConfigCachingScenario()
{
$_ENV['WORKOS_API_KEY'] = "pk_test_laravel_cached";
$_ENV['WORKOS_CLIENT_ID'] = "client_test_laravel_cached";
$this->assertEquals("pk_test_laravel_cached", WorkOS::getApiKey());
$this->assertEquals("client_test_laravel_cached", WorkOS::getClientId());
}
}