Skip to content

Commit

Permalink
Fix testDefaultStoreFolderForiOSDevicesIsTheApplicationSupportFolder …
Browse files Browse the repository at this point in the history
…for Xcode 10.2 by using an existing function to test for store locations, similarly to 2af80acc107e20dbf44a7822e5d16cc34103df97
  • Loading branch information
Coeur committed Jun 1, 2019
1 parent 8be7136 commit e5e1735
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 43 deletions.
42 changes: 6 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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
Expand Down
13 changes: 6 additions & 7 deletions Tests/Core/NSPersistentStoreHelperTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
Expand Down

0 comments on commit e5e1735

Please sign in to comment.