From d9958973e04fbed1e9d214bd3b55972c88327d28 Mon Sep 17 00:00:00 2001 From: Phil Young Date: Tue, 22 Jun 2021 10:42:20 +0100 Subject: [PATCH] Appease PHPMD This was a good spot, as I can reuse this declaration in another PR --- tests/Endpoints/CustomHostnamesTest.php | 129 +++++++++++++----------- 1 file changed, 68 insertions(+), 61 deletions(-) diff --git a/tests/Endpoints/CustomHostnamesTest.php b/tests/Endpoints/CustomHostnamesTest.php index 276776c..f3fae3d 100644 --- a/tests/Endpoints/CustomHostnamesTest.php +++ b/tests/Endpoints/CustomHostnamesTest.php @@ -17,61 +17,7 @@ class CustomHostnamesTest extends TestCase $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); $mock->method('post')->willReturn($response); - $customKey = <<getCustomSsl(); $mock->expects($this->once()) ->method('post') @@ -89,8 +35,8 @@ CERTIFICATE; 'min_tls_version' => '1.2', ], 'bundle_method' => 'optimal', - 'custom_key' => $customKey, - 'custom_certificate' => $customCertificate, + 'custom_key' => $customSsl['key'], + 'custom_certificate' => $customSsl['certificate'], 'wildcard' => true, ], ]) @@ -112,10 +58,7 @@ CERTIFICATE; 'origin.example.com', true, 'optimal', - [ - 'key' => $customKey, - 'certificate' => $customCertificate, - ] + $customSsl ); $this->assertEquals('0d89c70d-ad9f-4843-b99f-6cc0252067e9', $hostname->getBody()->result->id); } @@ -231,4 +174,68 @@ CERTIFICATE; $this->assertEquals('0d89c70d-ad9f-4843-b99f-6cc0252067e9', $result->id); $this->assertEquals('0d89c70d-ad9f-4843-b99f-6cc0252067e9', $zones->getBody()->id); } + + private function getCustomSsl(): array + { + $customKey = << $customKey, + 'certificate' => $customCertificate, + ]; + } }