commandListTest.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. require_once __DIR__ . '/../vendor/autoload.php';
  3. class commandListTest extends \PHPUnit\Framework\TestCase
  4. {
  5. public function testUser(): void
  6. {
  7. $command = new \ProfiCloS\VestaCP\Command\Lists\User('admin');
  8. $this->assertSame('v-list-user', $command->getName());
  9. $this->assertSame(['arg1' => 'admin', 'arg2' => 'json'], $command->getRequestParams());
  10. $this->assertFalse($command->needReturnCode());
  11. $this->expectException(TypeError::class);
  12. $command->process();
  13. }
  14. public function testUsers(): void
  15. {
  16. $command = new \ProfiCloS\VestaCP\Command\Lists\Users();
  17. $this->assertSame('v-list-users', $command->getName());
  18. $this->assertSame(['arg1' => 'json'], $command->getRequestParams());
  19. $this->expectException(TypeError::class);
  20. $command->process();
  21. }
  22. public function testWebDomains(): void
  23. {
  24. $command = new \ProfiCloS\VestaCP\Command\Lists\WebDomains('admin');
  25. $this->assertSame('v-list-web-domains', $command->getName());
  26. $this->assertSame(['arg1' => 'admin', 'arg2' => 'json'], $command->getRequestParams());
  27. $this->expectException(TypeError::class);
  28. $command->process();
  29. }
  30. public function testMailDomains(): void
  31. {
  32. $command = new \ProfiCloS\VestaCP\Command\Lists\MailDomains('admin');
  33. $this->assertSame('v-list-mail-domains', $command->getName());
  34. $this->assertSame(['arg1' => 'admin', 'arg2' => 'json'], $command->getRequestParams());
  35. }
  36. public function testMailDomainDkim(): void
  37. {
  38. $command = new \ProfiCloS\VestaCP\Command\Lists\MailDomainDkim('admin', 'domain');
  39. $this->assertSame('v-list-mail-domain-dkim', $command->getName());
  40. $this->assertSame(['arg1' => 'admin', 'arg2' => 'domain', 'arg3' => 'json'], $command->getRequestParams());
  41. $this->assertSame('', $command->getResponseText());
  42. }
  43. public function testMailDomainDkimDns(): void
  44. {
  45. $command = new \ProfiCloS\VestaCP\Command\Lists\MailDomainDkimDns('admin', 'domain');
  46. $this->assertSame('v-list-mail-domain-dkim-dns', $command->getName());
  47. $this->assertSame(['arg1' => 'admin', 'arg2' => 'domain', 'arg3' => 'json'], $command->getRequestParams());
  48. $this->assertSame('', $command->getResponseText());
  49. }
  50. public function testMailAccounts(): void
  51. {
  52. $command = new \ProfiCloS\VestaCP\Command\Lists\MailAccounts('admin', 'domain');
  53. $this->assertSame('v-list-mail-accounts', $command->getName());
  54. $this->assertSame(['arg1' => 'admin', 'arg2' => 'domain', 'arg3' => 'json'], $command->getRequestParams());
  55. }
  56. }