Skip to content

Commit 19a0806

Browse files
committed
[internal-api-php-client] fix: change instance method calls in JobRuntimeResolverTest
1 parent d730add commit 19a0806

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

tests/JobFactory/JobRuntimeResolverTest.php

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,23 @@ public function testResolveDefaultBackendContext(
104104
],
105105
];
106106

107-
$storageClient = self::createMock(BranchAwareClient::class);
108-
$storageClient->expects(self::exactly(1))->method('apiGet')
107+
$storageClient = $this->createMock(BranchAwareClient::class);
108+
$storageClient->expects(self::once())->method('apiGet')
109109
->withConsecutive(
110110
[sprintf('components/%s', $componentId)],
111111
)->willReturnOnConsecutiveCalls(
112112
$componentData,
113113
);
114-
$clientWrapperMock = self::createMock(ClientWrapper::class);
114+
$clientWrapperMock = $this->createMock(ClientWrapper::class);
115115
$clientWrapperMock->method('getBranchClient')->willReturn($storageClient);
116-
$storageClientFactoryMock = self::createMock(StorageClientPlainFactory::class);
116+
$storageClientFactoryMock = $this->createMock(StorageClientPlainFactory::class);
117117
$storageClientFactoryMock
118-
->expects(self::exactly(1))
118+
->expects(self::once())
119119
->method('createClientWrapper')
120120
->willReturn($clientWrapperMock);
121121
$jobRuntimeResolver = new JobRuntimeResolver($storageClientFactoryMock);
122122

123-
$jobData = $jobRuntimeResolver->resolveJobData($jobData, $this->createToken([]));
123+
$jobData = $jobRuntimeResolver->resolveJobData($jobData, $this->createToken());
124124
self::assertSame($expectedJobType->value, $jobData['type']);
125125
self::assertSame($expectedContext, $jobData['backend']['context']);
126126
}
@@ -171,7 +171,7 @@ public function testResolveRuntimeSettingsInJob(): void
171171
],
172172
];
173173

174-
$storageClient = self::createMock(BranchAwareClient::class);
174+
$storageClient = $this->createMock(BranchAwareClient::class);
175175
$storageClient->expects(self::exactly(2))->method('apiGet')
176176
->withConsecutive(
177177
['components/keboola.ex-db-snowflake'],
@@ -218,7 +218,7 @@ public function testResolveRuntimeSettingsInJob(): void
218218
'type' => 'container',
219219
'variableValuesId' => null,
220220
],
221-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
221+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
222222
);
223223
}
224224

@@ -247,7 +247,7 @@ public function testResolveRuntimeSettingsInConfigData(): void
247247
],
248248
];
249249

250-
$storageClient = self::createMock(BranchAwareClient::class);
250+
$storageClient = $this->createMock(BranchAwareClient::class);
251251
$storageClient->expects(self::once())->method('apiGet')
252252
->withConsecutive(
253253
['components/keboola.ex-db-snowflake'],
@@ -298,7 +298,7 @@ public function testResolveRuntimeSettingsInConfigData(): void
298298
'variableValuesId' => '123',
299299
'variableValuesData' => [],
300300
],
301-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
301+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
302302
);
303303
}
304304

@@ -338,7 +338,7 @@ public function testResolveRuntimeSettingsInConfiguration(): void
338338
],
339339
];
340340

341-
$storageClient = self::createMock(BranchAwareClient::class);
341+
$storageClient = $this->createMock(BranchAwareClient::class);
342342
$storageClient->expects(self::exactly(2))->method('apiGet')
343343
->withConsecutive(
344344
['components/keboola.ex-db-snowflake'],
@@ -385,7 +385,7 @@ public function testResolveRuntimeSettingsInConfiguration(): void
385385
],
386386
],
387387
],
388-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
388+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
389389
);
390390
}
391391

@@ -414,7 +414,7 @@ public function testResolveRuntimeSettingsInConfigurationOfTransformations(): vo
414414
],
415415
];
416416

417-
$storageClient = self::createMock(BranchAwareClient::class);
417+
$storageClient = $this->createMock(BranchAwareClient::class);
418418
$storageClient->expects(self::exactly(2))->method('apiGet')
419419
->withConsecutive(
420420
['components/keboola.ex-db-snowflake'],
@@ -453,7 +453,7 @@ public function testResolveRuntimeSettingsInConfigurationOfTransformations(): vo
453453
'variableValuesId' => null,
454454
'variableValuesData' => [],
455455
],
456-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
456+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
457457
);
458458
}
459459

@@ -491,7 +491,7 @@ public function testResolveRuntimeSettingsPriority(): void
491491
],
492492
];
493493

494-
$storageClient = self::createMock(BranchAwareClient::class);
494+
$storageClient = $this->createMock(BranchAwareClient::class);
495495
$storageClient->expects(self::exactly(2))->method('apiGet')
496496
->withConsecutive(
497497
['components/keboola.ex-db-snowflake'],
@@ -540,7 +540,7 @@ public function testResolveRuntimeSettingsPriority(): void
540540
'type' => 'standard',
541541
'variableValuesData' => [],
542542
],
543-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
543+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
544544
);
545545
}
546546

@@ -554,7 +554,7 @@ public function testResolveRuntimeSettingsNowhere(): void
554554
],
555555
];
556556

557-
$storageClient = self::createMock(BranchAwareClient::class);
557+
$storageClient = $this->createMock(BranchAwareClient::class);
558558
$storageClient->expects(self::exactly(2))->method('apiGet')
559559
->withConsecutive(
560560
['components/keboola.ex-db-snowflake'],
@@ -609,7 +609,7 @@ public function testResolveExecutor(
609609
$jobData = array_merge(self::JOB_DATA, $jobData);
610610
$jobData['configData'] = $configData;
611611

612-
$storageClient = self::createMock(BranchAwareClient::class);
612+
$storageClient = $this->createMock(BranchAwareClient::class);
613613
$storageClient->expects(self::exactly(2))
614614
->method('apiGet')
615615
->with(self::callback(function (...$args) {
@@ -791,25 +791,25 @@ public function testResolveInvalidConfigurationFailsWithClientException(): void
791791
'parameters' => ['foo' => 'bar'],
792792
];
793793

794-
$storageClient = self::createMock(BranchAwareClient::class);
795-
$storageClient->expects(self::exactly(1))->method('apiGet')
794+
$storageClient = $this->createMock(BranchAwareClient::class);
795+
$storageClient->expects(self::once())->method('apiGet')
796796
->with('components/keboola.ex-db-snowflake')
797797
->willReturn($this->getTestExtractorComponentData())
798798
;
799799

800800
$jobRuntimeResolver = new JobRuntimeResolver(
801801
$this->prepareStorageClientFactoryMock($storageClient),
802802
);
803-
self::expectException(ClientException::class);
804-
self::expectExceptionCode(0);
805-
self::expectExceptionMessage('Invalid configuration: Invalid type for path "overrides.variableValuesData".');
803+
$this->expectException(ClientException::class);
804+
$this->expectExceptionCode(0);
805+
$this->expectExceptionMessage('Invalid configuration: Invalid type for path "overrides.variableValuesData".');
806806
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken());
807807
}
808808

809809
public function testResolveRuntimeSettingsConfigurationNotFound(): void
810810
{
811811
$jobData = self::JOB_DATA;
812-
$storageClient = self::createMock(BranchAwareClient::class);
812+
$storageClient = $this->createMock(BranchAwareClient::class);
813813
$countMatcher = self::exactly(2);
814814
$storageClient->expects($countMatcher)->method('apiGet')
815815
->withConsecutive(
@@ -827,9 +827,9 @@ public function testResolveRuntimeSettingsConfigurationNotFound(): void
827827
$jobRuntimeResolver = new JobRuntimeResolver(
828828
$this->prepareStorageClientFactoryMock($storageClient),
829829
);
830-
self::expectExceptionMessage('Cannot resolve job parameters: Configuration "454124290" not found');
831-
self::expectExceptionCode(0);
832-
self::expectException(ClientException::class);
830+
$this->expectExceptionMessage('Cannot resolve job parameters: Configuration "454124290" not found');
831+
$this->expectExceptionCode(0);
832+
$this->expectException(ClientException::class);
833833
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken());
834834
}
835835

@@ -838,8 +838,8 @@ public function testResolveNoConfiguration(): void
838838
$jobData = self::JOB_DATA;
839839
unset($jobData['configId']);
840840

841-
$storageClient = self::createMock(BranchAwareClient::class);
842-
$storageClient->expects(self::exactly(1))->method('apiGet')
841+
$storageClient = $this->createMock(BranchAwareClient::class);
842+
$storageClient->expects(self::once())->method('apiGet')
843843
->with('components/keboola.ex-db-snowflake')
844844
->willReturn($this->getTestExtractorComponentData())
845845
;
@@ -881,8 +881,8 @@ public function testResolveEmptyConfiguration(): void
881881
$jobData = self::JOB_DATA;
882882
$jobData['configId'] = '';
883883

884-
$storageClient = self::createMock(BranchAwareClient::class);
885-
$storageClient->expects(self::exactly(1))->method('apiGet')
884+
$storageClient = $this->createMock(BranchAwareClient::class);
885+
$storageClient->expects(self::once())->method('apiGet')
886886
->with('components/keboola.ex-db-snowflake')
887887
->willReturn($this->getTestExtractorComponentData())
888888
;
@@ -925,7 +925,7 @@ public function testResolveEmptyConfigurationData(): void
925925
$jobData = self::JOB_DATA;
926926
$jobData['configId'] = '123456';
927927

928-
$storageClient = self::createMock(BranchAwareClient::class);
928+
$storageClient = $this->createMock(BranchAwareClient::class);
929929
$storageClient->expects(self::exactly(2))->method('apiGet')
930930
->withConsecutive(
931931
['components/keboola.ex-db-snowflake'],
@@ -993,7 +993,7 @@ public function testInternalCacheIsClearedForEveryCall(): void
993993
],
994994
];
995995

996-
$storageClient = self::createMock(BranchAwareClient::class);
996+
$storageClient = $this->createMock(BranchAwareClient::class);
997997
$storageClient->expects(self::exactly(4))->method('apiGet')
998998
->withConsecutive(
999999
['components/keboola.ex-db-snowflake'],
@@ -1028,15 +1028,15 @@ public function testResolveInvalidComponent(): void
10281028
],
10291029
];
10301030

1031-
$storageClient = self::createMock(BranchAwareClient::class);
1031+
$storageClient = $this->createMock(BranchAwareClient::class);
10321032
$storageClient->expects(self::once())->method('apiGet')
10331033
->with('components/keboola.ex-db-snowflake')->willReturn($component);
10341034

10351035
$jobRuntimeResolver = new JobRuntimeResolver(
10361036
$this->prepareStorageClientFactoryMock($storageClient),
10371037
);
1038-
self::expectExceptionMessage('The component "keboola.ex-db-snowflake" is not runnable.');
1039-
self::expectException(ClientException::class);
1038+
$this->expectExceptionMessage('The component "keboola.ex-db-snowflake" is not runnable.');
1039+
$this->expectException(ClientException::class);
10401040
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken());
10411041
}
10421042

@@ -1066,7 +1066,7 @@ public function testResolveBranchConfiguration(): void
10661066
],
10671067
];
10681068

1069-
$storageClient = self::createMock(BranchAwareClient::class);
1069+
$storageClient = $this->createMock(BranchAwareClient::class);
10701070
$storageClient->expects(self::exactly(2))->method('apiGet')
10711071
->withConsecutive(
10721072
['components/keboola.ex-db-snowflake'],
@@ -1116,7 +1116,7 @@ public function testResolveBranchConfiguration(): void
11161116
],
11171117
],
11181118
],
1119-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
1119+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
11201120
);
11211121
}
11221122

@@ -1131,7 +1131,7 @@ public function testConfigurationDisabledException(): void
11311131
],
11321132
];
11331133

1134-
$storageClient = self::createMock(BranchAwareClient::class);
1134+
$storageClient = $this->createMock(BranchAwareClient::class);
11351135
$storageClient->expects(self::exactly(2))->method('apiGet')
11361136
->withConsecutive(
11371137
['components/keboola.ex-db-snowflake'],
@@ -1145,8 +1145,8 @@ public function testConfigurationDisabledException(): void
11451145
$this->prepareStorageClientFactoryMock($storageClient),
11461146
);
11471147

1148-
self::expectException(ConfigurationDisabledException::class);
1149-
self::expectExceptionMessage('Configuration "454124290" of component "keboola.ex-db-snowflake" is disabled.');
1148+
$this->expectException(ConfigurationDisabledException::class);
1149+
$this->expectExceptionMessage('Configuration "454124290" of component "keboola.ex-db-snowflake" is disabled.');
11501150
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken());
11511151
}
11521152

@@ -1182,7 +1182,7 @@ public function testResolveBackend(
11821182
];
11831183
$jobData['parallelism'] = '5';
11841184

1185-
$storageClient = self::createMock(BranchAwareClient::class);
1185+
$storageClient = $this->createMock(BranchAwareClient::class);
11861186
$storageClient->expects(self::exactly($expectedApiCallCount))->method('apiGet')
11871187
->with(sprintf('components/%s', $componentId))
11881188
->willReturn(
@@ -1746,7 +1746,7 @@ public function testMergeJobDataBackendWithBackendFromConfig(
17461746

17471747
$componentData = $this->getTestComponentData('workspace-snowflake');
17481748

1749-
$storageClient = self::createMock(BranchAwareClient::class);
1749+
$storageClient = $this->createMock(BranchAwareClient::class);
17501750
$storageClient->expects(self::exactly(2))->method('apiGet')
17511751
->withConsecutive(
17521752
['components/keboola.ex-db-snowflake'],
@@ -1785,7 +1785,7 @@ public function testMergeJobDataBackendWithBackendFromConfig(
17851785
'variableValuesId' => null,
17861786
'variableValuesData' => [],
17871787
],
1788-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
1788+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
17891789
);
17901790
}
17911791

@@ -1801,8 +1801,8 @@ public function testResolveBranch(
18011801
$jobData['configId'] = null;
18021802
$jobData['tag'] = '1.2.3';
18031803

1804-
$storageClient = self::createMock(BranchAwareClient::class);
1805-
$storageClient->expects(self::exactly(1))->method('apiGet')
1804+
$storageClient = $this->createMock(BranchAwareClient::class);
1805+
$storageClient->expects(self::once())->method('apiGet')
18061806
->with('components/keboola.ex-db-snowflake')
18071807
->willReturn($this->getTestComponentData());
18081808

@@ -1840,7 +1840,7 @@ public function testResolveBranch(
18401840
'variableValuesId' => null,
18411841
'variableValuesData' => [],
18421842
],
1843-
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken([])),
1843+
$jobRuntimeResolver->resolveJobData($jobData, $this->createToken()),
18441844
);
18451845
}
18461846

@@ -1879,15 +1879,15 @@ private function prepareStorageClientFactoryMock(
18791879
string $actualBranchId = self::DEFAULT_BRANCH_ID,
18801880
bool $actualBranchIsDefault = true,
18811881
): StorageClientPlainFactory {
1882-
$clientWrapper = self::createMock(ClientWrapper::class);
1882+
$clientWrapper = $this->createMock(ClientWrapper::class);
18831883
$clientWrapper->expects(self::exactly($expectedInvocationCount))
18841884
->method('getBranchClient')
18851885
->willReturn($storageClient)
18861886
;
18871887
$clientWrapper->method('isDefaultBranch')->willReturn($actualBranchIsDefault);
18881888
$clientWrapper->method('getBranchId')->willReturn($actualBranchId);
18891889

1890-
$storageClientFactory = self::createMock(StorageClientPlainFactory::class);
1890+
$storageClientFactory = $this->createMock(StorageClientPlainFactory::class);
18911891
$storageClientFactory->expects(self::exactly($expectedInvocationCount))
18921892
->method('createClientWrapper')
18931893
->with(new ClientOptions(
@@ -2096,22 +2096,22 @@ public function testResolveJobType(string $componentId, array $customJobData, Jo
20962096
],
20972097
];
20982098

2099-
$storageClient = self::createMock(BranchAwareClient::class);
2100-
$storageClient->expects(self::exactly(1))->method('apiGet')
2099+
$storageClient = $this->createMock(BranchAwareClient::class);
2100+
$storageClient->expects(self::once())->method('apiGet')
21012101
->with(sprintf('components/%s', $componentId))
21022102
->willReturn($componentData);
21032103

2104-
$clientWrapperMock = self::createMock(ClientWrapper::class);
2104+
$clientWrapperMock = $this->createMock(ClientWrapper::class);
21052105
$clientWrapperMock->method('getBranchClient')->willReturn($storageClient);
2106-
$storageClientFactoryMock = self::createMock(StorageClientPlainFactory::class);
2106+
$storageClientFactoryMock = $this->createMock(StorageClientPlainFactory::class);
21072107
$storageClientFactoryMock
2108-
->expects(self::exactly(1))
2108+
->expects(self::once())
21092109
->method('createClientWrapper')
21102110
->willReturn($clientWrapperMock);
21112111

21122112
$jobRuntimeResolver = new JobRuntimeResolver($storageClientFactoryMock);
21132113

2114-
$resolvedJobData = $jobRuntimeResolver->resolveJobData($jobData, $this->createToken([]));
2114+
$resolvedJobData = $jobRuntimeResolver->resolveJobData($jobData, $this->createToken());
21152115

21162116
self::assertSame(
21172117
$expectedType->value,

0 commit comments

Comments
 (0)