| @@ 66-79 (lines=14) @@ | ||
| 63 | static::assertTrue($file->exists(), "The original file should still exist"); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testInvokeFlow() |
|
| 67 | { |
|
| 68 | $file = $this->makeFile('copy/invoke/source', 'some text'); |
|
| 69 | $target = $this->makeFile('copy/invoke/target'); |
|
| 70 | ||
| 71 | $flow = Flow::copyFile($target); |
|
| 72 | ||
| 73 | $output = call_user_func($flow, $file); |
|
| 74 | ||
| 75 | static::assertSame($target, $output); |
|
| 76 | static::assertInstanceOf(FileNode::class, $output); |
|
| 77 | static::assertEquals($file->getContents(), $output->getContents()); |
|
| 78 | static::assertTrue($file->exists(), "The original file should still exist"); |
|
| 79 | } |
|
| 80 | ||
| 81 | public function testCopyFileWithDirectoryTargetWillUseOriginalFileName() |
|
| 82 | { |
|
| @@ 36-49 (lines=14) @@ | ||
| 33 | $flow->flow($file); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function testCopyFileCreatesANewFile() |
|
| 37 | { |
|
| 38 | $file = $this->makeFile('move/flow/source', 'some text'); |
|
| 39 | $target = $this->makeFile('move/flow/target'); |
|
| 40 | ||
| 41 | $flow = new MoveFile($target); |
|
| 42 | ||
| 43 | $output = $flow->flow($file); |
|
| 44 | ||
| 45 | static::assertSame($target, $output); |
|
| 46 | static::assertInstanceOf(FileNode::class, $output); |
|
| 47 | static::assertEquals(['some text'], $output->getContents()); |
|
| 48 | static::assertFalse($file->exists(), "The original file should not exist"); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function testStaticFlow() |
|
| 52 | { |
|
| @@ 51-64 (lines=14) @@ | ||
| 48 | static::assertFalse($file->exists(), "The original file should not exist"); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function testStaticFlow() |
|
| 52 | { |
|
| 53 | $file = $this->makeFile('move/static/source', 'some text'); |
|
| 54 | $target = $this->makeFile('move/static/target'); |
|
| 55 | ||
| 56 | $flow = Flow::moveFile($target); |
|
| 57 | ||
| 58 | $output = $flow->flow($file); |
|
| 59 | ||
| 60 | static::assertSame($target, $output); |
|
| 61 | static::assertInstanceOf(FileNode::class, $output); |
|
| 62 | static::assertEquals(['some text'], $output->getContents()); |
|
| 63 | static::assertFalse($file->exists(), "The original file should still exist"); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testInvokeFlow() |
|
| 67 | { |
|
| @@ 66-79 (lines=14) @@ | ||
| 63 | static::assertFalse($file->exists(), "The original file should still exist"); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testInvokeFlow() |
|
| 67 | { |
|
| 68 | $file = $this->makeFile('move/invoke/source', 'some text'); |
|
| 69 | $target = $this->makeFile('move/invoke/target'); |
|
| 70 | ||
| 71 | $flow = Flow::moveFile($target); |
|
| 72 | ||
| 73 | $output = call_user_func($flow, $file); |
|
| 74 | ||
| 75 | static::assertSame($target, $output); |
|
| 76 | static::assertInstanceOf(FileNode::class, $output); |
|
| 77 | static::assertEquals(['some text'], $output->getContents()); |
|
| 78 | static::assertFalse($file->exists(), "The original file should still exist"); |
|
| 79 | } |
|
| 80 | ||
| 81 | public function testCopyFileWithDirectoryTargetWillUseOriginalFileName() |
|
| 82 | { |
|