CheckReadTokenFileTest.php 740 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace YdbPlatform\Ydb\Test;
  3. use PHPUnit\Framework\TestCase;
  4. use YdbPlatform\Ydb\Auth\ReadTokenFromFile;
  5. use YdbPlatform\Ydb\Ydb;
  6. use YdbPlatform\Ydb\YdbTable;
  7. class CheckReadTokenFileTest extends TestCase{
  8. public function testReadTokenFile(){
  9. $config = [
  10. // Database path
  11. 'database' => '/local',
  12. // Database endpoint
  13. 'endpoint' => 'localhost:2136',
  14. // Auto discovery (dedicated server only)
  15. 'discovery' => false,
  16. 'credentials' => new ReadTokenFromFile("./tests/token.txt")
  17. ];
  18. $ydb = new Ydb($config);
  19. self::assertEquals('test-example-token',
  20. $ydb->iam()->token()
  21. );
  22. }
  23. }