From 293335f9d3e93e60bd6672b7e9ac7c19ecbf02c5 Mon Sep 17 00:00:00 2001 From: Heinz Wiesinger Date: Fri, 31 Jan 2025 10:06:07 +0100 Subject: [PATCH] Spark: Update to latest Lunr.Halo --- .../Spark/Contentful/Tests/ApiBaseTest.php | 2 +- .../Contentful/Tests/ApiGetBaseUrlTest.php | 18 ++++++------- .../Spark/Contentful/Tests/ApiSetTest.php | 2 +- .../Tests/{ApiTest.php => ApiTestCase.php} | 6 ++--- .../Contentful/Tests/DeliveryApiBaseTest.php | 2 +- .../Tests/DeliveryApiGetAssetsTest.php | 14 +++++----- .../Tests/DeliveryApiGetEntriesTest.php | 2 +- .../Tests/DeliveryApiGetJsonResultsTest.php | 16 ++++++------ ...eryApiTest.php => DeliveryApiTestCase.php} | 6 ++--- .../Tests/ManagementApiBaseTest.php | 2 +- .../Tests/ManagementApiCreateEntryTest.php | 2 +- .../Tests/ManagementApiGetEntryTest.php | 2 +- .../Tests/ManagementApiPublishEntryTest.php | 2 +- ...tApiTest.php => ManagementApiTestCase.php} | 6 ++--- .../Tests/ManagementApiUnpublishEntryTest.php | 2 +- ...p => ManagementApiUpdateEntryTestCase.php} | 4 +-- .../Contentful/Tests/PreviewApiBaseTest.php | 2 +- ...viewApiTest.php => PreviewApiTestCase.php} | 6 ++--- .../CentralAuthenticationStoreBaseTest.php | 26 +++++++++---------- ...=> CentralAuthenticationStoreTestCase.php} | 6 ++--- .../Spark/Tests/LunrSoapClientHeaderTest.php | 2 +- .../Spark/Tests/LunrSoapClientInitTest.php | 2 +- ...entTest.php => LunrSoapClientTestCase.php} | 6 ++--- 23 files changed, 69 insertions(+), 69 deletions(-) rename src/Lunr/Spark/Contentful/Tests/{ApiTest.php => ApiTestCase.php} (95%) rename src/Lunr/Spark/Contentful/Tests/{DeliveryApiTest.php => DeliveryApiTestCase.php} (93%) rename src/Lunr/Spark/Contentful/Tests/{ManagementApiTest.php => ManagementApiTestCase.php} (93%) rename src/Lunr/Spark/Contentful/Tests/{ManagementApiUpdateEntryTest.php => ManagementApiUpdateEntryTestCase.php} (96%) rename src/Lunr/Spark/Contentful/Tests/{PreviewApiTest.php => PreviewApiTestCase.php} (93%) rename src/Lunr/Spark/Tests/{CentralAuthenticationStoreTest.php => CentralAuthenticationStoreTestCase.php} (84%) rename src/Lunr/Spark/Tests/{LunrSoapClientTest.php => LunrSoapClientTestCase.php} (85%) diff --git a/src/Lunr/Spark/Contentful/Tests/ApiBaseTest.php b/src/Lunr/Spark/Contentful/Tests/ApiBaseTest.php index 275ccbad..c355cd05 100644 --- a/src/Lunr/Spark/Contentful/Tests/ApiBaseTest.php +++ b/src/Lunr/Spark/Contentful/Tests/ApiBaseTest.php @@ -17,7 +17,7 @@ * * @covers Lunr\Spark\Contentful\Api */ -class ApiBaseTest extends ApiTest +class ApiBaseTest extends ApiTestCase { use PsrLoggerTestTrait; diff --git a/src/Lunr/Spark/Contentful/Tests/ApiGetBaseUrlTest.php b/src/Lunr/Spark/Contentful/Tests/ApiGetBaseUrlTest.php index d6ed7dcf..89f67e26 100644 --- a/src/Lunr/Spark/Contentful/Tests/ApiGetBaseUrlTest.php +++ b/src/Lunr/Spark/Contentful/Tests/ApiGetBaseUrlTest.php @@ -15,7 +15,7 @@ * * @covers Lunr\Spark\Contentful\Api */ -class ApiGetBaseUrlTest extends ApiTest +class ApiGetBaseUrlTest extends ApiTestCase { /** @@ -25,7 +25,7 @@ class ApiGetBaseUrlTest extends ApiTest */ public function testGetBaseUrlWithoutValues(): void { - $method = $this->get_accessible_reflection_method('get_base_url'); + $method = $this->getReflectionMethod('get_base_url'); $result = $method->invoke($this->class); $this->assertSame('https://www.contentful.com', $result); @@ -38,9 +38,9 @@ public function testGetBaseUrlWithoutValues(): void */ public function testGetBaseUrlWithOnlySpace(): void { - $this->set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); - $method = $this->get_accessible_reflection_method('get_base_url'); + $method = $this->getReflectionMethod('get_base_url'); $result = $method->invoke($this->class); $this->assertSame('https://www.contentful.com/spaces/5p4c31D', $result); @@ -53,9 +53,9 @@ public function testGetBaseUrlWithOnlySpace(): void */ public function testGetBaseUrlWithOnlyEnvironment(): void { - $this->set_reflection_property_value('environment', 'master'); + $this->setReflectionPropertyValue('environment', 'master'); - $method = $this->get_accessible_reflection_method('get_base_url'); + $method = $this->getReflectionMethod('get_base_url'); $result = $method->invoke($this->class); $this->assertSame('https://www.contentful.com/environments/master', $result); @@ -68,10 +68,10 @@ public function testGetBaseUrlWithOnlyEnvironment(): void */ public function testGetBaseUrlWithAllValues(): void { - $this->set_reflection_property_value('space', '5p4c31D'); - $this->set_reflection_property_value('environment', 'master'); + $this->setReflectionPropertyValue('space', '5p4c31D'); + $this->setReflectionPropertyValue('environment', 'master'); - $method = $this->get_accessible_reflection_method('get_base_url'); + $method = $this->getReflectionMethod('get_base_url'); $result = $method->invoke($this->class); $this->assertSame('https://www.contentful.com/spaces/5p4c31D/environments/master', $result); diff --git a/src/Lunr/Spark/Contentful/Tests/ApiSetTest.php b/src/Lunr/Spark/Contentful/Tests/ApiSetTest.php index 8118af32..a2240678 100644 --- a/src/Lunr/Spark/Contentful/Tests/ApiSetTest.php +++ b/src/Lunr/Spark/Contentful/Tests/ApiSetTest.php @@ -15,7 +15,7 @@ * * @covers Lunr\Spark\Contentful\Api */ -class ApiSetTest extends ApiTest +class ApiSetTest extends ApiTestCase { /** diff --git a/src/Lunr/Spark/Contentful/Tests/ApiTest.php b/src/Lunr/Spark/Contentful/Tests/ApiTestCase.php similarity index 95% rename from src/Lunr/Spark/Contentful/Tests/ApiTest.php rename to src/Lunr/Spark/Contentful/Tests/ApiTestCase.php index ebf93a3a..11d6ff19 100644 --- a/src/Lunr/Spark/Contentful/Tests/ApiTest.php +++ b/src/Lunr/Spark/Contentful/Tests/ApiTestCase.php @@ -1,7 +1,7 @@ set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); $this->cache->expects($this->once()) ->method('getItem') @@ -87,7 +87,7 @@ public function testGetAssetsWithoutFiltersReturnsEmptyResultOnRequestError(): v */ public function testGetAssetsWithFiltersReturnsEmptyResultOnRequestError(): void { - $this->set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); $this->cache->expects($this->once()) ->method('getItem') @@ -146,7 +146,7 @@ public function testGetAssetsWithFiltersReturnsEmptyResultOnRequestError(): void */ public function testGetAssetsWithoutFiltersReturnsEmptyResultOnRequestFailure(): void { - $this->set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); $this->cache->expects($this->once()) ->method('getItem') @@ -193,7 +193,7 @@ public function testGetAssetsWithoutFiltersReturnsEmptyResultOnRequestFailure(): */ public function testGetAssetsWithFiltersReturnsEmptyResultOnRequestFailure(): void { - $this->set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); $this->cache->expects($this->once()) ->method('getItem') @@ -240,7 +240,7 @@ public function testGetAssetsWithFiltersReturnsEmptyResultOnRequestFailure(): vo */ public function testGetAssetsWithoutFiltersReturnsResultsOnSuccessfulRequest(): void { - $this->set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); $output = [ 'param1' => 1, @@ -279,7 +279,7 @@ public function testGetAssetsWithoutFiltersReturnsResultsOnSuccessfulRequest(): */ public function testGetAssetsWithFiltersReturnsResultsOnSuccessfulRequest(): void { - $this->set_reflection_property_value('space', '5p4c31D'); + $this->setReflectionPropertyValue('space', '5p4c31D'); $output = [ 'param1' => 1, diff --git a/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetEntriesTest.php b/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetEntriesTest.php index 547d60b8..c084237d 100644 --- a/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetEntriesTest.php +++ b/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetEntriesTest.php @@ -18,7 +18,7 @@ * * @covers Lunr\Spark\Contentful\DeliveryApi */ -class DeliveryApiGetEntriesTest extends DeliveryApiTest +class DeliveryApiGetEntriesTest extends DeliveryApiTestCase { /** diff --git a/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetJsonResultsTest.php b/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetJsonResultsTest.php index 0a7e3af9..45050fc6 100644 --- a/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetJsonResultsTest.php +++ b/src/Lunr/Spark/Contentful/Tests/DeliveryApiGetJsonResultsTest.php @@ -18,7 +18,7 @@ * * @covers Lunr\Spark\Contentful\DeliveryApi */ -class DeliveryApiGetJsonResultsTest extends DeliveryApiTest +class DeliveryApiGetJsonResultsTest extends DeliveryApiTestCase { /** @@ -33,7 +33,7 @@ public function testGetJsonResultsMakesGetRequestWithoutParams(): void ->with('http://localhost', [], []) ->willReturn($this->response); - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $method->invokeArgs($this->class, [ 'http://localhost', [] ]); } @@ -50,7 +50,7 @@ public function testGetJsonResultsMakesGetRequestWithParams(): void ->with('http://localhost', [], [ 'param1' => 1, 'param2' => 2 ]) ->willReturn($this->response); - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $method->invokeArgs($this->class, [ 'http://localhost', [ 'param1' => 1, 'param2' => 2 ] ]); } @@ -86,7 +86,7 @@ public function testGetJsonResultsThrowsErrorIfRequestHadError(): void ->method('warning') ->with('Contentful API Request ({request}) failed with id "{id}": {message}', $context); - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $method->invokeArgs($this->class, [ 'http://localhost' ]); } @@ -112,7 +112,7 @@ public function testGetJsonResultsThrowsErrorIfRequestFailed(): void ->method('warning') ->with('Contentful API Request ({request}) failed! {message}', $context); - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $method->invokeArgs($this->class, [ 'http://localhost' ]); } @@ -135,7 +135,7 @@ public function testGetJsonResultsDoesNotThrowErrorIfRequestSuccessful(): void $this->logger->expects($this->never()) ->method('error'); - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $method->invokeArgs($this->class, [ 'http://localhost' ]); } @@ -165,7 +165,7 @@ public function testGetJsonResultsReturnsEmptyResultOnRequestError(): void $this->response->body = json_encode($output); $this->response->url = 'http://localhost/url'; - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $value = $method->invokeArgs($this->class, [ 'http://localhost' ]); @@ -194,7 +194,7 @@ public function testGetJsonResultsReturnsResultsOnSuccessfulRequest(): void $this->response->status_code = 200; $this->response->body = json_encode($output); - $method = $this->get_accessible_reflection_method('get_json_results'); + $method = $this->getReflectionMethod('get_json_results'); $this->assertEquals([ 'param1' => 1, 'param2' => 2 ], $method->invokeArgs($this->class, [ 'http://localhost' ])); } diff --git a/src/Lunr/Spark/Contentful/Tests/DeliveryApiTest.php b/src/Lunr/Spark/Contentful/Tests/DeliveryApiTestCase.php similarity index 93% rename from src/Lunr/Spark/Contentful/Tests/DeliveryApiTest.php rename to src/Lunr/Spark/Contentful/Tests/DeliveryApiTestCase.php index 9c426d82..ded2c39f 100644 --- a/src/Lunr/Spark/Contentful/Tests/DeliveryApiTest.php +++ b/src/Lunr/Spark/Contentful/Tests/DeliveryApiTestCase.php @@ -1,7 +1,7 @@ assertArrayEmpty($this->get_reflection_property_value('store')); + $this->assertArrayEmpty($this->getReflectionPropertyValue('store')); } /** @@ -35,7 +35,7 @@ public function testAddCreatesModuleIndexIfNotExists(): void { $this->class->add('module', 'key', 'value'); - $this->assertArrayHasKey('module', $this->get_reflection_property_value('store')); + $this->assertArrayHasKey('module', $this->getReflectionPropertyValue('store')); } /** @@ -47,7 +47,7 @@ public function testAddAddsNewValue(): void { $this->class->add('module', 'key', 'value'); - $module = $this->get_reflection_property_value('store')['module']; + $module = $this->getReflectionPropertyValue('store')['module']; $this->assertArrayHasKey('key', $module); $this->assertEquals('value', $module['key']); @@ -60,11 +60,11 @@ public function testAddAddsNewValue(): void */ public function testAddOverwritesOldValue(): void { - $this->set_reflection_property_value('store', [ 'module' => [ 'key' => 'value1' ] ]); + $this->setReflectionPropertyValue('store', [ 'module' => [ 'key' => 'value1' ] ]); $this->class->add('module', 'key', 'value'); - $module = $this->get_reflection_property_value('store')['module']; + $module = $this->getReflectionPropertyValue('store')['module']; $this->assertArrayHasKey('key', $module); $this->assertEquals('value', $module['key']); @@ -77,11 +77,11 @@ public function testAddOverwritesOldValue(): void */ public function testDeleteUnsetsExistingIndex(): void { - $this->set_reflection_property_value('store', [ 'module' => [ 'key' => 'value' ] ]); + $this->setReflectionPropertyValue('store', [ 'module' => [ 'key' => 'value' ] ]); $this->class->delete('module', 'key'); - $module = $this->get_reflection_property_value('store')['module']; + $module = $this->getReflectionPropertyValue('store')['module']; $this->assertArrayEmpty($module); } @@ -93,13 +93,13 @@ public function testDeleteUnsetsExistingIndex(): void */ public function testDeleteDoesNothingWhenIndexDoesNotExist(): void { - $this->set_reflection_property_value('store', [ 'module' => [ 'key' => 'value' ] ]); + $this->setReflectionPropertyValue('store', [ 'module' => [ 'key' => 'value' ] ]); - $before = $this->get_reflection_property_value('store'); + $before = $this->getReflectionPropertyValue('store'); $this->class->delete('module', 'key1'); - $after = $this->get_reflection_property_value('store'); + $after = $this->getReflectionPropertyValue('store'); $this->assertSame($before, $after); } @@ -121,7 +121,7 @@ public function testGetReturnsNullWhenModuleIndexDoesNotExist(): void */ public function testGetReturnsNullWhenIndexDoesNotExist(): void { - $this->set_reflection_property_value('store', [ 'module' => [ 'key' => 'value' ] ]); + $this->setReflectionPropertyValue('store', [ 'module' => [ 'key' => 'value' ] ]); $this->assertNull($this->class->get('module', 'key1')); } @@ -133,7 +133,7 @@ public function testGetReturnsNullWhenIndexDoesNotExist(): void */ public function testGetReturnsValueWhenIndexExists(): void { - $this->set_reflection_property_value('store', [ 'module' => [ 'key' => 'value' ] ]); + $this->setReflectionPropertyValue('store', [ 'module' => [ 'key' => 'value' ] ]); $this->assertEquals('value', $this->class->get('module', 'key')); } diff --git a/src/Lunr/Spark/Tests/CentralAuthenticationStoreTest.php b/src/Lunr/Spark/Tests/CentralAuthenticationStoreTestCase.php similarity index 84% rename from src/Lunr/Spark/Tests/CentralAuthenticationStoreTest.php rename to src/Lunr/Spark/Tests/CentralAuthenticationStoreTestCase.php index ef5d3980..c7fc3a1f 100644 --- a/src/Lunr/Spark/Tests/CentralAuthenticationStoreTest.php +++ b/src/Lunr/Spark/Tests/CentralAuthenticationStoreTestCase.php @@ -1,7 +1,7 @@