diff --git a/README.md b/README.md index 21172ed..45591e8 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,12 @@ $companyCode, $restApiUserName, $restApiPassword, $evidenceName, -$enableSelfSignedCertificate, +$disableSelfSignedCertificate, $authSessionId, $logPath, ); ``` -`$enableSelfSignedCertificate - Vyžadání self signed certifikátu` +`$disableSelfSignedCertificate - Vypnutí self signed certifikátu` `$authSessionId - Hodnota authentikačního id pro Flexibee` diff --git a/src/Client.php b/src/Client.php index ca7087a..2690819 100644 --- a/src/Client.php +++ b/src/Client.php @@ -27,7 +27,7 @@ public function __construct( string $user, string $password, string $evidence, - bool $selfSignedCertificate, + bool $disableSelfSignedCertificate, ?string $authSessionId = null, ?string $logFilePath = null ) @@ -38,7 +38,7 @@ public function __construct( $user, $password, $evidence, - $selfSignedCertificate, + $disableSelfSignedCertificate, $authSessionId, $logFilePath, ); diff --git a/src/CompanyClient.php b/src/CompanyClient.php index 9c4a704..13e113e 100644 --- a/src/CompanyClient.php +++ b/src/CompanyClient.php @@ -18,7 +18,7 @@ public function __construct(Config $config) $config->getUser(), $config->getPassword(), self::EVIDENCE, - $config->isSelfSignedCertificate(), + $config->isDisableSelfSignedCertificate(), $config->getAuthSessionId(), ); } diff --git a/src/Config.php b/src/Config.php index cc48764..df44b05 100644 --- a/src/Config.php +++ b/src/Config.php @@ -6,19 +6,12 @@ final class Config { private string $url; - private string $company; - private string $user; - private string $password; - private string $evidence; - - private bool $selfSignedCertificate; - + private bool $disableSelfSignedCertificate; private ?string $authSessionId; - private ?string $logFilePath; public function __construct( @@ -27,7 +20,7 @@ public function __construct( string $user, string $password, string $evidence, - bool $selfSignedCertificate, + bool $disableSelfSignedCertificate, ?string $authSessionId = null, ?string $logFilePath = null ) @@ -37,7 +30,7 @@ public function __construct( $this->user = $user; $this->password = $password; $this->evidence = $evidence; - $this->selfSignedCertificate = $selfSignedCertificate; + $this->disableSelfSignedCertificate = $disableSelfSignedCertificate; $this->authSessionId = $authSessionId; $this->logFilePath = $logFilePath; } @@ -67,9 +60,9 @@ public function getEvidence(): string return $this->evidence; } - public function isSelfSignedCertificate(): bool + public function isDisableSelfSignedCertificate(): bool { - return $this->selfSignedCertificate; + return $this->disableSelfSignedCertificate; } public function getAuthSessionId(): ?string diff --git a/src/Http/HttpClient.php b/src/Http/HttpClient.php index 74facfb..7c132e5 100644 --- a/src/Http/HttpClient.php +++ b/src/Http/HttpClient.php @@ -10,7 +10,6 @@ final class HttpClient { private \EcomailFlexibee\Http\UrlNormalizer $urlNormalizer; - private \EcomailFlexibee\Http\HttpCurlBuilder $httpCurlBuilder; public function __construct() { diff --git a/src/Http/HttpCurlBuilder.php b/src/Http/HttpCurlBuilder.php index 6dcea0b..110593d 100644 --- a/src/Http/HttpCurlBuilder.php +++ b/src/Http/HttpCurlBuilder.php @@ -32,7 +32,7 @@ public function build(string $url, Method $httpMethod, array $postFields, array \curl_setopt($ch, \CURLOPT_CUSTOMREQUEST, $httpMethod->getValue()); \curl_setopt($ch, \CURLOPT_USERAGENT, 'Ecomail.cz Flexibee client (https://github.com/Ecomailcz/flexibee-client)'); - if ($config->isSelfSignedCertificate() || $config->getAuthSessionId() !== null) { + if ($config->isDisableSelfSignedCertificate() || $config->getAuthSessionId() !== null) { \curl_setopt($ch, \CURLOPT_SSL_VERIFYPEER, FALSE); \curl_setopt($ch, \CURLOPT_SSL_VERIFYHOST, FALSE); } diff --git a/tests/CompanyClientTest.php b/tests/CompanyClientTest.php deleted file mode 100644 index a5b79aa..0000000 --- a/tests/CompanyClientTest.php +++ /dev/null @@ -1,46 +0,0 @@ -config = new \EcomailFlexibee\Config( - Config::HOST, - Config::COMPANY, - Config::USERNAME, - Config::PASSWORD, - 'c', - false, - null, - ); - } - - public function testBackup(): void - { - /** @var \EcomailFlexibee\CompanyClient|\Mockery\MockInterface $bankClientMock */ - $bankClientMock = Mockery::mock(BankClient::class, [$this->config])->makePartial(); - $bankClientMock->shouldReceive('backup')->andReturnTrue(); - Assert::assertTrue($bankClientMock->backup()); - } - - public function testAutomaticPairing(): void - { - /** @var \EcomailFlexibee\CompanyClient|\Mockery\MockInterface $bankClientMock */ - $bankClientMock = Mockery::mock(BankClient::class, [$this->config])->makePartial(); - $bankClientMock->shouldReceive('restore')->andReturnTrue(); - Assert::assertTrue($bankClientMock->restore('demo', '')); - } -}