Api3DocTrait
trait Api3DocTrait
Class Api3DocTrait
Traits
Properties
protected int | $_apiversion | Api version - easier to override than just a define | from Api3TestTrait |
Methods
Check that api returned 'is_error' => 1 else provide full message
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.
This function exists to wrap api functions.
Tidy up examples array so that fields that change often .
Details
in Api3TestTrait at line 24
array
versionThreeAndFour()
Get the api versions to test.
in Api3TestTrait at line 48
assertAPIArrayComparison(array $result, $expected, array $valuesToExclude = [], string $prefix = '')
Check that api returned 'is_error' => 1 else provide full message
in Api3TestTrait at line 67
assertAPIDeleted($entity, $id)
Check that a deleted item has been deleted.
in Api3TestTrait at line 80
assertAPIFailure(array $apiResult, string $prefix = '', null $expectedError = NULL)
Check that api returned 'is_error' => 1.
in Api3TestTrait at line 99
assertAPISuccess(array $apiResult, string $prefix = '')
Check that api returned 'is_error' => 0.
in Api3TestTrait 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
in Api3TestTrait 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
in Api3TestTrait 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
in Api3TestTrait 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
in Api3TestTrait 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
in Api3TestTrait 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.
in Api3TestTrait at line 308
array|int
runApi4Legacy($v3Entity, $v3Action, array $v3Params = [])
Emulate v3 syntax so we can run api3 tests on v4
in Api3TestTrait at line 623
protected array
runApi4LegacyChain(string $key, mixed $params, string $mainEntity, array $result, bool $sequential)
in Api3TestTrait at line 677
static string
convertEntityNameToApi4(string $legacyName)
Fix the naming differences between api3 & api4 entities.
at line 41
array|int
callAPIAndDocument(string $entity, string $action, array $params, string $function, string $file, string $description = "", string|null $exampleName = NULL)
This function exists to wrap api functions.
so we can ensure they succeed, generate and example & throw exceptions without litterering the test with checks
at line 140
tidyExampleResult(array $result)
Tidy up examples array so that fields that change often .
.don't and debug related fields are unset