@@ -497,7 +497,33 @@ - (void)testUploadCancel {
497
497
[self waitForTestExpectations ];
498
498
}
499
499
500
- - (void )testClearCaches {
500
+ - (void )testClearFileCache {
501
+ id mockedDataSource = PFStrictProtocolMock (@protocol (PFFileManagerProvider));
502
+ id mockedFileManager = PFStrictClassMock ([PFFileManager class ]);
503
+
504
+ NSString *temporaryPath = [self temporaryDirectory ];
505
+ NSString *downloadsPath = [temporaryPath stringByAppendingPathComponent: @" downloads" ];
506
+
507
+ OCMStub ([mockedDataSource fileManager ]).andReturn (mockedFileManager);
508
+ OCMStub ([mockedFileManager parseLocalSandboxDataDirectoryPath ]).andReturn (temporaryPath);
509
+ OCMStub ([mockedFileManager parseCacheItemPathForPathComponent: @" PFFileCache" ]).andReturn (downloadsPath);
510
+
511
+ PFFileController *fileController = [PFFileController controllerWithDataSource: mockedDataSource];
512
+ PFFileState *fileState = [[PFMutableFileState alloc ] initWithName: @" sampleData"
513
+ urlString: temporaryPath
514
+ mimeType: @" application/octet-stream" ];
515
+
516
+ XCTestExpectation *expectation = [self currentSelectorTestExpectation ];
517
+ [[fileController clearFileCacheAsyncForFileWithState: fileState] continueWithBlock: ^id (BFTask *task) {
518
+ XCTAssertNil (task.error );
519
+ [expectation fulfill ];
520
+ return nil ;
521
+ }];
522
+
523
+ [self waitForTestExpectations ];
524
+ }
525
+
526
+ - (void )testClearAllFilesCache {
501
527
id mockedDataSource = PFStrictProtocolMock (@protocol (PFFileManagerProvider));
502
528
id mockedFileManager = PFStrictClassMock ([PFFileManager class ]);
503
529
@@ -511,7 +537,7 @@ - (void)testClearCaches {
511
537
PFFileController *fileController = [PFFileController controllerWithDataSource: mockedDataSource];
512
538
513
539
XCTestExpectation *expectation = [self currentSelectorTestExpectation ];
514
- [[fileController clearFileCacheAsync ] continueWithBlock: ^id (BFTask *task) {
540
+ [[fileController clearAllFileCacheAsync ] continueWithBlock: ^id (BFTask *task) {
515
541
XCTAssertNil (task.error );
516
542
[expectation fulfill ];
517
543
return nil ;
0 commit comments