3 use Dkan\Datastore\Importer;
4 use Dkan\Datastore\Resource;
9 use MockChain\Sequence;
10 use FileFetcher\FileFetcher;
12 use MockChain\Options;
13 use PHPUnit\Framework\TestCase;
14 use Procrastinator\Result;
29 $options = (
new Options())
30 ->add(
'total_bytes_copied', 20)
31 ->add(
'total_bytes', 30)
32 ->add(
"hello",
"hello")
33 ->add(
"source",
"hello")
36 $fileFetcher = (
new Chain($this))
37 ->add(FileFetcher::class,
"getStateProperty", $options)
38 ->add(FileFetcher::class,
"getResult", Result::class)
39 ->add(Result::class,
"getStatus", Result::DONE)
42 $sequence =
new Sequence();
43 $sequence->add([
"1"]);
46 $jobStore = (
new Chain($this))
47 ->add(JobStore::class,
"retrieveAll", $sequence)
50 $jobStoreFactory = (
new Chain($this))
51 ->add(JobStoreFactory::class,
"getInstance", $jobStore)
54 $resourceServiceFactory = (
new Chain($this))
55 ->add(ResourceFactory::class,
"getInstance", ResourceService::class)
56 ->add(ResourceService::class,
"getFileFetcher", $fileFetcher)
57 ->add(ResourceService::class,
"get",
new Resource(
"blah",
"",
"text/csv"))
60 $importServiceFactory = (
new Chain($this))
61 ->add(ImportFactory::class,
"getInstance", ImportService::class)
62 ->add(ImportService::class,
"getImporter", Importer::class)
65 $list = ImporterList::getList($jobStoreFactory, $resourceServiceFactory, $importServiceFactory);
66 $this->assertTrue(is_array($list));