This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
forked from vilanovi/PersistentModel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preparing test bundle to create tests
- Loading branch information
Showing
39 changed files
with
623 additions
and
159 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.mobilejazz.$(PRODUCT_NAME:rfc1034identifier)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
83 changes: 83 additions & 0 deletions
83
PersistentModel/PersistentModel Tests/PersistentModel_Tests.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// PersistentModel_Tests.m | ||
// PersistentModel Tests | ||
// | ||
// Created by Joan Martin on 16/12/14. | ||
// Copyright (c) 2014 Joan Martin. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <XCTest/XCTest.h> | ||
|
||
#import "PersistentModel.h" | ||
|
||
NSURL* applicationCacheDirectory() | ||
{ | ||
static NSURL *url = nil; | ||
|
||
static dispatch_once_t onceToken; | ||
|
||
dispatch_once(&onceToken, ^{ | ||
NSArray *pathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); | ||
NSString *cachePath = [pathList[0] stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]]; | ||
|
||
// Create cache path if it doesn't exist, yet: | ||
BOOL isDir = NO; | ||
NSError *error; | ||
if (! [[NSFileManager defaultManager] fileExistsAtPath:cachePath isDirectory:&isDir] && isDir == NO) | ||
[[NSFileManager defaultManager] createDirectoryAtPath:cachePath withIntermediateDirectories:YES attributes:nil error:&error]; | ||
|
||
url = [NSURL fileURLWithPath:cachePath]; | ||
}); | ||
|
||
return url; | ||
} | ||
|
||
@interface PersistentModel_Tests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation PersistentModel_Tests | ||
{ | ||
PMPersistentStore *_persistentStore; | ||
PMObjectContext *_objectContext; | ||
} | ||
|
||
- (void)setUp | ||
{ | ||
[super setUp]; | ||
|
||
// Creating the URL where we will store the database | ||
NSURL *url = [applicationCacheDirectory() URLByAppendingPathComponent:@"test.sql"]; | ||
|
||
// Instantiating the persistent store | ||
_persistentStore = [[PMSQLiteStore alloc] initWithURL:url]; | ||
|
||
// Creating an object context connected to the persistent store | ||
_objectContext = [[PMObjectContext alloc] initWithPersistentStore:_persistentStore]; | ||
} | ||
|
||
- (void)tearDown | ||
{ | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testExample | ||
{ | ||
// This is an example of a functional test case. | ||
XCTAssert(YES, @"Pass"); | ||
} | ||
|
||
- (void)testPerformanceExample | ||
{ | ||
// This is an example of a performance test case. | ||
[self measureBlock:^{ | ||
// Put the code you want to measure the time of here. | ||
}]; | ||
} | ||
|
||
#pragma mark - Index | ||
|
||
|
||
@end |
297 changes: 260 additions & 37 deletions
297
...istentModelTest.xcodeproj/project.pbxproj → ...PersistentModel.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...lTest/PersistentModelTest/PMAppDelegate.h → ...tentModel/PersistentModel/PMAppDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lTest/PersistentModelTest/PMAppDelegate.m → ...tentModel/PersistentModel/PMAppDelegate.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...entModelTest/PersistentModelTest/PMUser.h → PersistentModel/PersistentModel/PMUser.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ntModelTest/PersistentModelTest/PMVideo.h → PersistentModel/PersistentModel/PMVideo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...stentModelTest/PersistentModelTest/main.m → PersistentModel/PersistentModel/main.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Uncomment this line to define a global platform for your project | ||
# platform :ios, "6.0" | ||
|
||
target 'PersistentModel' do | ||
pod 'FMDB', '~> 2.2' | ||
end | ||
|
||
target 'PersistentModel Tests' do | ||
pod 'FMDB', '~> 2.2' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.