Skip to content
Permalink
Browse files

Fix testDefaultStoreFolderForiOSDevicesIsTheApplicationSupportFolder …

…for Xcode 10.2 by using an existing function to test for store locations, similarly to 2af80ac
  • Loading branch information...
Coeur committed Jun 1, 2019
1 parent 8be7136 commit e5e1735bfa68ef11ed0ecf4a40c6193280456ea2
Showing with 12 additions and 43 deletions.
  1. +6 −36 .travis.yml
  2. +6 −7 Tests/Core/NSPersistentStoreHelperTests.m
@@ -22,51 +22,21 @@ matrix:
# xcode_scheme: libMagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=11.4,name=iPhone X
# env: DEVICE="iPhone X (11.4)"
#BROKEN like below and by testThatInternalEntityNameReturnsClassNameWhenEntityNameMethodIsNotImplemented (since iOS 10.0)
#- osx_image: xcode10.2
# xcode_scheme: MagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=10.3.1,name=iPhone 7 Plus
# env: DEVICE="iPhone 7 Plus (10.3.1)"
#BROKEN like below and by testThatInternalEntityNameReturnsClassNameWhenEntityNameMethodIsNotImplemented (since iOS 10.0)
#- osx_image: xcode10.2
# xcode_scheme: libMagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=10.3.1,name=iPhone 7 Plus
# env: DEVICE="iPhone 7 Plus (10.3.1)"
#BROKEN like below
#- osx_image: xcode10.2
# xcode_scheme: MagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=9.3,name=iPhone 6s Plus
# env: DEVICE="iPhone 6s Plus (9.3)"
#BROKEN like below
#- osx_image: xcode10.2
# xcode_scheme: libMagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=9.3,name=iPhone 6s Plus
# env: DEVICE="iPhone 6s Plus (9.3)"
#BROKEN by testDefaultStoreFolderForiOSDevicesIsTheApplicationSupportFolder (since Xcode 10.2)
#- osx_image: xcode10.2
# xcode_scheme: MagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=8.1,name=iPhone 4s
# env: DEVICE="iPhone 4s (8.1)"
#BROKEN by testDefaultStoreFolderForiOSDevicesIsTheApplicationSupportFolder (since Xcode 10.2)
#- osx_image: xcode10.2
# xcode_scheme: libMagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=8.1,name=iPhone 4s
# env: DEVICE="iPhone 4s (8.1)"
#BROKEN by testThatInternalEntityNameReturnsClassNameWhenEntityNameMethodIsNotImplemented (since iOS 10.0)
#- osx_image: xcode10.1
#- osx_image: xcode10.2
# xcode_scheme: MagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=10.3.1,name=iPhone 7 Plus
# env: DEVICE="iPhone 7 Plus (10.3.1)"
#BROKEN by testThatInternalEntityNameReturnsClassNameWhenEntityNameMethodIsNotImplemented (since iOS 10.0)
#- osx_image: xcode10.1
#- osx_image: xcode10.2
# xcode_scheme: libMagicalRecord for iOS
# xcode_destination: platform=iOS Simulator,OS=10.3.1,name=iPhone 7 Plus
# env: DEVICE="iPhone 7 Plus (10.3.1)"
- osx_image: xcode10.1
- osx_image: xcode10.2
xcode_scheme: MagicalRecord for iOS
xcode_destination: platform=iOS Simulator,OS=9.3,name=iPhone 6s Plus
env: DEVICE="iPhone 6s Plus (9.3)"
- osx_image: xcode10.1
- osx_image: xcode10.2
xcode_scheme: libMagicalRecord for iOS
xcode_destination: platform=iOS Simulator,OS=9.3,name=iPhone 6s Plus
env: DEVICE="iPhone 6s Plus (9.3)"
@@ -78,12 +48,12 @@ matrix:
xcode_scheme: libMagicalRecord for iOS
xcode_destination: platform=iOS Simulator,OS=8.1,name=iPhone 4s
env: DEVICE="iPhone 4s (8.1)"
#BROKEN like below and by testDefaultStoreFolderForMacIsTheApplicationSupportDirectory (since Xcode 10.2)
#BROKEN like below
#- osx_image: xcode10.2
# xcode_scheme: MagicalRecord for OS X
# xcode_destination: platform=macOS
# env: DEVICE="OS X 10.14"
#BROKEN like below and by testDefaultStoreFolderForMacIsTheApplicationSupportDirectory (since Xcode 10.2)
#BROKEN like below
#- osx_image: xcode10.2
# xcode_scheme: libMagicalRecord for OS X
# xcode_destination: platform=macOS
@@ -14,18 +14,17 @@ @interface NSPersistentStoreHelperTests : XCTestCase

@end

@implementation NSPersistentStoreHelperTests
@interface NSPersistentStore (MagicalRecordPrivate)
+ (NSString *)MR_applicationStorageDirectory;
@end

- (NSString *) applicationStorageDirectory
{
return [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject];
}
@implementation NSPersistentStoreHelperTests

#if TARGET_OS_IPHONE

- (void) testDefaultStoreFolderForiOSDevicesIsTheApplicationSupportFolder
{
NSString *applicationLibraryDirectory = [self applicationStorageDirectory];
NSString *applicationLibraryDirectory = [NSPersistentStore MR_applicationStorageDirectory];
NSString *expectedStorePath = [applicationLibraryDirectory stringByAppendingPathComponent:kMagicalRecordDefaultStoreFileName];
NSURL *expectedStoreUrl = [NSURL fileURLWithPath:expectedStorePath];
NSURL *defaultStoreUrl = [NSPersistentStore MR_defaultLocalStoreUrl];
@@ -36,7 +35,7 @@ - (void) testDefaultStoreFolderForiOSDevicesIsTheApplicationSupportFolder
- (void) testCanFindAURLInTheLibraryForiOSForASpecifiedStoreName
{
NSString *storeFileName = @"NotTheDefaultStoreName.storefile";
NSString *applicationLibraryDirectory = [self applicationStorageDirectory];
NSString *applicationLibraryDirectory = [NSPersistentStore MR_applicationStorageDirectory];
NSString *expectedStorePath = [applicationLibraryDirectory stringByAppendingPathComponent:storeFileName];

BOOL fileWasCreated = [[NSFileManager defaultManager] createFileAtPath:expectedStorePath contents:[storeFileName dataUsingEncoding:NSUTF8StringEncoding] attributes:nil];

0 comments on commit e5e1735

Please sign in to comment.
You can’t perform that action at this time.