xref: /plugin/struct/_test/mock/CSVPageImporter.php (revision 17dbef8af8e73f5c6a6bdbfcb629a48d85005bd7)
1<?php
2
3
4namespace dokuwiki\plugin\struct\test\mock;
5
6
7class CSVPageImporter extends \dokuwiki\plugin\struct\meta\CSVPageImporter
8{
9
10    /** @var \Generator */
11    protected $testData;
12
13    public function setTestData(array $testData)
14    {
15        $this->testData = $this->testDataGenerator($testData);
16
17    }
18
19    protected function openFile($file)
20    {
21    }
22
23    protected function getLine()
24    {
25        if (!$this->testData->valid()) {
26            return $this->testData->getReturn();
27        }
28        $current = $this->testData->current();
29        $this->testData->next();
30        return $current;
31    }
32
33    protected function testDataGenerator($testData)
34    {
35        foreach ($testData as $line) {
36            yield $line;
37        }
38
39        return false;
40    }
41}
42