commandTest.php 844 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. require_once __DIR__ . '/../vendor/autoload.php';
  3. class commandTest extends \PHPUnit\Framework\TestCase
  4. {
  5. public function testCommands(): void
  6. {
  7. $command = new \ProfiCloS\VestaCP\Command\TestAuthorization();
  8. $this->assertSame('', $command->getName());
  9. $this->assertSame([], $command->getRequestParams());
  10. $this->assertTrue($command->needReturnCode());
  11. $this->expectException(\ProfiCloS\VestaCP\InvalidResponseException::class);
  12. $command->process();
  13. $this->assertNull($command->getResponseText());
  14. $this->expectException(\ProfiCloS\VestaCP\InvalidResponseException::class);
  15. $this->assertNull($command->getResponseCode());
  16. $command->defaultProcess();
  17. $this->expectException(\ProfiCloS\VestaCP\ProcessException::class);
  18. $command->processException(new \GuzzleHttp\Exception\ClientException('throw!'));
  19. }
  20. }