Skip to content

Commit 412caba

Browse files
authored
Create TestEnvTypes.php
1 parent f52c345 commit 412caba

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

tests/TestEnvTypes.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
namespace YdbPlatform\Ydb\Test;
3+
4+
use PHPUnit\Framework\TestCase;
5+
use YdbPlatform\Ydb\Auth\EnvironCredentials;
6+
use YdbPlatform\Ydb\Ydb;
7+
use YdbPlatform\Ydb\YdbTable;
8+
9+
class TestEnvTypes extends TestCase{
10+
11+
public function testEnvTypes(){
12+
13+
$dataset = [
14+
[
15+
"env" => [
16+
"name" => "YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS",
17+
"value" => "./some.json"
18+
],
19+
"wait" => "SA JSON key"
20+
],
21+
[
22+
"env" => [
23+
"name" => "YDB_ACCESS_TOKEN_CREDENTIALS",
24+
"value" => "76254876234"
25+
],
26+
"wait" => "Access token"
27+
],
28+
[
29+
"env" => [
30+
"name" => "YDB_ANONYMOUS_CREDENTIALS",
31+
"value" => "1"
32+
],
33+
"wait" => "Anonymous"
34+
],
35+
[
36+
"env" => [
37+
"name" => "YDB_METADATA_CREDENTIALS",
38+
"value" => "1"
39+
],
40+
"wait" => "Metadata URL"
41+
],
42+
[
43+
"env" => [
44+
"name" => "YDB_ANONYMOUS_CREDENTIALS",
45+
"value" => "0"
46+
],
47+
"wait" => "Metadata URL"
48+
],
49+
[
50+
"env" => [
51+
"name" => "none",
52+
"value" => "none"
53+
],
54+
"wait" => "Metadata URL"
55+
],
56+
];
57+
foreach ($dataset as $data){
58+
putenv($data["env"]["name"]."=".$data["env"]["value"]);
59+
self::assertEquals(
60+
$data["wait"],
61+
(new EnvironCredentials())->getName()
62+
);
63+
putenv($data["env"]["name"]);
64+
}
65+
66+
}
67+
}

0 commit comments

Comments
 (0)