|
@@ 37-50 (lines=14) @@
|
| 34 |
|
$flow->flow($file); |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
public function testMakeDirectory() |
| 38 |
|
{ |
| 39 |
|
$file1 = $this->makeFile('merge/initial/file1', "line 1\nline 2\n"); |
| 40 |
|
$file2 = $this->makeFile('merge/initial/file2', "line 3\nline 4\n"); |
| 41 |
|
$merged = $this->makeFile('merge/initial/merged'); |
| 42 |
|
|
| 43 |
|
$flow = new Merge($merged); |
| 44 |
|
$collection = new FileNodeCollection([$file1, $file2]); |
| 45 |
|
|
| 46 |
|
$output = $flow->flow($collection); |
| 47 |
|
|
| 48 |
|
static::assertSame($output, $merged); |
| 49 |
|
static::assertEquals(["line 1", "line 2", "line 3", "line 4"], $output->getContents()); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
public function testStaticFlow() |
| 53 |
|
{ |
|
@@ 52-65 (lines=14) @@
|
| 49 |
|
static::assertEquals(["line 1", "line 2", "line 3", "line 4"], $output->getContents()); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
public function testStaticFlow() |
| 53 |
|
{ |
| 54 |
|
$file1 = $this->makeFile('merge/static/file1', "line 1\nline 2\n"); |
| 55 |
|
$file2 = $this->makeFile('merge/static/file2', "line 3\nline 4\n"); |
| 56 |
|
$merged = $this->makeFile('merge/static/merged'); |
| 57 |
|
|
| 58 |
|
$flow = Flow::merge($merged); |
| 59 |
|
$collection = new FileNodeCollection([$file1, $file2]); |
| 60 |
|
|
| 61 |
|
$output = $flow->flow($collection); |
| 62 |
|
|
| 63 |
|
static::assertSame($output, $merged); |
| 64 |
|
static::assertEquals(["line 1", "line 2", "line 3", "line 4"], $output->getContents()); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function testInvokeFlow() |
| 68 |
|
{ |
|
@@ 67-80 (lines=14) @@
|
| 64 |
|
static::assertEquals(["line 1", "line 2", "line 3", "line 4"], $output->getContents()); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function testInvokeFlow() |
| 68 |
|
{ |
| 69 |
|
$file1 = $this->makeFile('merge/invoke/file1', "line 1\nline 2\n"); |
| 70 |
|
$file2 = $this->makeFile('merge/invoke/file2', "line 3\nline 4\n"); |
| 71 |
|
$merged = $this->makeFile('merge/invoke/merged'); |
| 72 |
|
|
| 73 |
|
$flow = new Merge($merged); |
| 74 |
|
$collection = new FileNodeCollection([$file1, $file2]); |
| 75 |
|
|
| 76 |
|
$output = call_user_func($flow, $collection); |
| 77 |
|
|
| 78 |
|
static::assertSame($output, $merged); |
| 79 |
|
static::assertEquals(["line 1", "line 2", "line 3", "line 4"], $output->getContents()); |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
|
|