Browse Source

IPS-91 Check both XCTestConfigurationFilePath and XCTestProbe

IPS-91
Dirk Zimmermann 6 months ago
parent
commit
eb0c138d29
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      pEpObjCAdapter/PEPObjCAdapter.m

+ 6
- 3
pEpObjCAdapter/PEPObjCAdapter.m View File

@ -275,14 +275,17 @@ static id<PEPPassphraseProviderProtocol> s_passphraseProvider = nil;
/// This is only used under macOS, although it should work on iOS as well.
+ (BOOL)isXCTestRunning
{
id xctestConfig = [[[NSProcessInfo processInfo] environment] valueForKey:@"XCTestConfigurationFilePath"];
BOOL isTesting = NO;
Class testProbeClass = NSClassFromString(@"XCTestProbe");
if (testProbeClass) {
NSNumber *numberValue = [testProbeClass valueForKey:@"isTesting"];
return [numberValue boolValue];
isTesting = [numberValue boolValue];
}
return NO;
id configFp = [[[NSProcessInfo processInfo] environment]
valueForKey:@"XCTestConfigurationFilePath"];
return isTesting || configFp != nil;
}
/// Creates a pEp directory for use by the engine that is nowhere in a production data area, for use by XCTests.


Loading…
Cancel
Save