@@ 25-39 (lines=15) @@ | ||
22 | $this->fixtures->cleanup(); |
|
23 | } |
|
24 | ||
25 | public function testConcat() |
|
26 | { |
|
27 | $this->fixtures->createAndCdToSandbox(); |
|
28 | ||
29 | $result = $this->taskConcat(['a.txt', 'b.txt']) |
|
30 | ->to('merged.txt') |
|
31 | ->run(); |
|
32 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
|
33 | $this->assertFileExists('merged.txt'); |
|
34 | $expected = "A\nB\n"; |
|
35 | $actual = file_get_contents('merged.txt'); |
|
36 | $this->assertEquals($expected, $actual); |
|
37 | ||
38 | ||
39 | } |
|
40 | ||
41 | } |
|
42 |
@@ 26-44 (lines=19) @@ | ||
23 | $this->fixtures->cleanup(); |
|
24 | } |
|
25 | ||
26 | public function writeFewLines() |
|
27 | { |
|
28 | // write lines with WriteToFile task |
|
29 | $result = $this->taskWriteToFile('blogpost.md') |
|
30 | ->line('****') |
|
31 | ->line('hello world') |
|
32 | ->line('****') |
|
33 | ->run(); |
|
34 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
|
35 | $this->assertFileExists('blogpost.md'); |
|
36 | $contents = file_get_contents('blogpost.md'); |
|
37 | $expreded = <<<HERE |
|
38 | **** |
|
39 | hello world |
|
40 | **** |
|
41 | ||
42 | HERE; |
|
43 | $this->assertContains($expected, $contents); |
|
44 | } |
|
45 | ||
46 | public function appendToFile() |
|
47 | { |
|
@@ 71-87 (lines=17) @@ | ||
68 | $this->assertEquals(true, $writeTask->wouldChange(), "Test file would change."); |
|
69 | } |
|
70 | ||
71 | public function insertFile() |
|
72 | { |
|
73 | $result = $this->taskWriteToFile('a.txt') |
|
74 | ->line('****') |
|
75 | ->textFromFile('b.txt') |
|
76 | ->line("C") |
|
77 | ->run(); |
|
78 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
|
79 | $this->assertFileExists('a.txt'); |
|
80 | $contents = file_get_contents('a.txt'); |
|
81 | $expected = <<<HERE |
|
82 | **** |
|
83 | BC |
|
84 | ||
85 | HERE; |
|
86 | $this->assertContains($expected, $contents); |
|
87 | } |
|
88 | ||
89 | public function appendIfMatch() |
|
90 | { |