clientTest.php 998 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use ProfiCloS\VestaCP\Authorization\Credentials;
  3. use ProfiCloS\VestaCP\Authorization\Host;
  4. use ProfiCloS\VestaCP\Client;
  5. require_once __DIR__ . '/../vendor/autoload.php';
  6. class clientTest extends \PHPUnit\Framework\TestCase
  7. {
  8. public function testHost(): void
  9. {
  10. $credentials = new Credentials('', '');
  11. $host = new Host('', $credentials);
  12. $client = new Client($host);
  13. $this->assertSame($host, $client->getHost());
  14. $otherHost = new Host('otherHost', $credentials);
  15. $client->setHost($otherHost);
  16. $this->assertNotSame($host, $client->getHost());
  17. $this->assertSame($otherHost, $client->getHost());
  18. }
  19. public function testSimpleFactory(): void
  20. {
  21. $client = Client::simpleFactory('someHost', 'someUser', 'somePass');
  22. $host = $client->getHost();
  23. $credentials = $host->getCredentials();
  24. $this->assertSame('someHost', $host->getHostname());
  25. $this->assertSame('someUser', $credentials->getUser());
  26. $this->assertSame('somePass', $credentials->getPassword());
  27. }
  28. }