4
4
5
5
use Contracts \Mock \Storage \Memory ;
6
6
use FileFetcher \FileFetcher ;
7
+ use FileFetcher \Processor \Local ;
8
+ use PHPUnit \Framework \TestCase ;
7
9
use Procrastinator \Result ;
8
10
9
11
class FileFetcherTest extends \PHPUnit \Framework \TestCase
@@ -18,7 +20,8 @@ public function testRemote()
18
20
"1 " ,
19
21
new Memory (),
20
22
[
21
- "filePath " => "http://samplecsvs.s3.amazonaws.com/Sacramentorealestatetransactions.csv "
23
+ "filePath " => "http://samplecsvs.s3.amazonaws.com/Sacramentorealestatetransactions.csv " ,
24
+ "processors " => [Local::class]
22
25
]
23
26
);
24
27
@@ -36,12 +39,15 @@ public function testLocal()
36
39
{
37
40
$ local_file = __DIR__ . "/files/tiny.csv " ;
38
41
42
+ $ config = [
43
+ "filePath " => $ local_file ,
44
+ "processors " => [TestCase::class]
45
+ ];
46
+
39
47
$ fetcher = FileFetcher::get (
40
48
"1 " ,
41
49
new Memory (),
42
- [
43
- "filePath " => $ local_file
44
- ]
50
+ $ config
45
51
);
46
52
47
53
$ fetcher ->setTimeLimit (1 );
@@ -64,7 +70,8 @@ public function testTimeOut()
64
70
{
65
71
$ store = new Memory ();
66
72
$ config = [
67
- "filePath " => "https://dkan-default-content-files.s3.amazonaws.com/ {$ this ->sampleCsvSize }_mb_sample.csv "
73
+ "filePath " => "https://dkan-default-content-files.s3.amazonaws.com/ {$ this ->sampleCsvSize }_mb_sample.csv " ,
74
+ "processors " => "Bad "
68
75
];
69
76
70
77
$ fetcher = FileFetcher::get ("1 " , $ store , $ config );
@@ -102,7 +109,8 @@ public function testIncompatibleServer()
102
109
"1 " ,
103
110
new Memory (),
104
111
[
105
- "filePath " => $ url
112
+ "filePath " => $ url ,
113
+ "processors " => ["Bad " ]
106
114
]
107
115
);
108
116
$ fetcher ->setTimeLimit (1 );
0 commit comments