Api3TestTrait
trait Api3TestTrait
Class Api3TestTrait
Properties
protected int | $_apiversion | Api version - easier to override than just a define |
Methods
Get the api versions to test.
Check that api returned 'is_error' => 1 else provide full message
Check that a deleted item has been deleted.
Check that api returned 'is_error' => 1.
Check that api returned 'is_error' => 0.
This function exists to wrap api functions.
wrap api functions.
This function exists to wrap api getValue function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks There is a type check in this
This function exists to wrap api getsingle function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks
This function exists to wrap api getValue function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks There is a type check in this
A stub for the API interface. This can be overriden by subclasses to change how the API is called.
Emulate v3 syntax so we can run api3 tests on v4
No description
Fix the naming differences between api3 & api4 entities.
Details
at line 24
array
versionThreeAndFour()
Get the api versions to test.
at line 48
assertAPIArrayComparison(array $result, $expected, array $valuesToExclude = [], string $prefix = '')
Check that api returned 'is_error' => 1 else provide full message
at line 67
assertAPIDeleted($entity, $id)
Check that a deleted item has been deleted.
at line 80
assertAPIFailure(array $apiResult, string $prefix = '', null $expectedError = NULL)
Check that api returned 'is_error' => 1.
at line 99
assertAPISuccess(array $apiResult, string $prefix = '')
Check that api returned 'is_error' => 0.
at line 125
array|int
callAPIFailure(string $entity, string $action, array $params, string $expectedErrorMessage = NULL, null $extraOutput = NULL)
This function exists to wrap api functions.
so we can ensure they fail where expected & throw exceptions without litterering the test with checks
at line 153
array|int
callAPISuccess(string $entity, string $action, array $params = [], mixed $checkAgainst = NULL)
wrap api functions.
so we can ensure they succeed & throw exceptions without litterering the test with checks
at line 188
array|int
callAPISuccessGetCount(string $entity, array $params, int $count = NULL)
This function exists to wrap api getValue function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks There is a type check in this
at line 222
array|int
callAPISuccessGetSingle(string $entity, array $params, array $checkAgainst = NULL)
This function exists to wrap api getsingle function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks
at line 261
array|int
callAPISuccessGetValue(string $entity, array $params, string $type = NULL)
This function exists to wrap api getValue function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks There is a type check in this
at line 290
array|int
civicrm_api($entity, $action, array $params = [])
A stub for the API interface. This can be overriden by subclasses to change how the API is called.
at line 308
array|int
runApi4Legacy($v3Entity, $v3Action, array $v3Params = [])
Emulate v3 syntax so we can run api3 tests on v4
at line 623
protected array
runApi4LegacyChain(string $key, mixed $params, string $mainEntity, array $result, bool $sequential)
at line 677
static string
convertEntityNameToApi4(string $legacyName)
Fix the naming differences between api3 & api4 entities.