|
29 | 29 | ], |
30 | 30 | ]); |
31 | 31 |
|
32 | | - expect('test')->toEqual($client->getClient()->getConfig('subject')); |
| 32 | + expect($client->getClient()->getConfig('subject'))->toEqual('test'); |
| 33 | +}); |
| 34 | + |
| 35 | +test('client fallback to use application default credentials', function () { |
| 36 | + $client = new Client([ |
| 37 | + 'service' => [ |
| 38 | + 'enable' => true, |
| 39 | + ], |
| 40 | + ]); |
| 41 | + |
| 42 | + expect($client->getClient()->isUsingApplicationDefaultCredentials())->toBeTrue(); |
33 | 43 | }); |
34 | 44 |
|
35 | 45 | test('client sets prompt or approval_prompt', function () { |
|
39 | 49 | ]); |
40 | 50 |
|
41 | 51 | // default value should be empty |
42 | | - expect('auto')->toEqual($client->getClient()->getConfig('prompt')); |
| 52 | + expect($client->getClient()->getConfig('prompt'))->toEqual('auto'); |
43 | 53 |
|
44 | 54 | // default value should be auto, since prompt is set, it should be ignored |
45 | | - expect('auto')->toEqual($client->getClient()->getConfig('approval_prompt')); |
| 55 | + expect($client->getClient()->getConfig('approval_prompt'))->toEqual('auto'); |
46 | 56 | }); |
47 | 57 |
|
48 | 58 | test('client sets approval_prompt', function () { |
|
51 | 61 | ]); |
52 | 62 |
|
53 | 63 | // default value should be empty |
54 | | - expect('')->toEqual($client->getClient()->getConfig('prompt')); |
| 64 | + expect($client->getClient()->getConfig('prompt'))->toBeEmpty(); |
55 | 65 |
|
56 | 66 | // default value should be auto |
57 | | - expect('consent')->toEqual($client->getClient()->getConfig('approval_prompt')); |
| 67 | + expect($client->getClient()->getConfig('approval_prompt'))->toEqual('consent'); |
58 | 68 | }); |
59 | 69 |
|
60 | 70 | test('service make', function () { |
|
68 | 78 | test('service make exception', function () { |
69 | 79 | $client = new Client(); |
70 | 80 |
|
71 | | - $this->expectException(UnknownServiceException::class); |
72 | | - |
73 | 81 | $client->make('storag'); |
74 | | -}); |
| 82 | +})->throws(UnknownServiceException::class); |
75 | 83 |
|
76 | 84 | test('magic method exception', function () { |
77 | 85 | $client = new Client(); |
78 | 86 |
|
79 | | - $this->expectException(BadMethodCallException::class); |
80 | | - |
81 | 87 | $client->getAuthTest(); |
82 | | -}); |
| 88 | +})->throws(BadMethodCallException::class); |
83 | 89 |
|
84 | 90 | test('no credentials', function () { |
85 | 91 | $client = new Client(); |
|
0 commit comments