|
@@ 103-111 (lines=9) @@
|
| 100 |
|
static::assertEquals(['some fish like pants should be replaced'], $newFile->getContents()); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
public function testCallingReplaceTextWithArraysThatHaveMismatchedCountsThrowsAnException() |
| 104 |
|
{ |
| 105 |
|
$file = new LocalFile(static::$dir . 'multiple_replace_failure.test'); |
| 106 |
|
$file->put('some text that text should be replaced'); |
| 107 |
|
|
| 108 |
|
$this->expectException(InvalidArgumentException::class); |
| 109 |
|
|
| 110 |
|
$this->replacer->replaceText($file, ['text', 'pants that'], ['pants']); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testCallingReplaceTextWithAnArrayAndStringThrowsAnException() |
| 114 |
|
{ |
|
@@ 113-120 (lines=8) @@
|
| 110 |
|
$this->replacer->replaceText($file, ['text', 'pants that'], ['pants']); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testCallingReplaceTextWithAnArrayAndStringThrowsAnException() |
| 114 |
|
{ |
| 115 |
|
$file = new LocalFile(static::$dir . 'multiple_replace_failure.test'); |
| 116 |
|
$file->put('some text that text should be replaced'); |
| 117 |
|
|
| 118 |
|
$this->expectException(InvalidArgumentException::class); |
| 119 |
|
$this->replacer->replaceText($file, ['text', 'pants that'], 'pants'); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
public function testAddingAPostfixToTheEndOfTheFile() |
| 123 |
|
{ |
|
@@ 187-195 (lines=9) @@
|
| 184 |
|
static::assertEquals('option_pass_through-pass.test', $newFile->getFilename()); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
public function testCallingModifyWithNoFromTextThrowsInvalidArgumentsException() |
| 188 |
|
{ |
| 189 |
|
$this->expectException(InvalidArgumentException::class); |
| 190 |
|
|
| 191 |
|
$file = new LocalFile(static::$dir . 'simple_replace.test'); |
| 192 |
|
$file->put('some text that text should be replaced'); |
| 193 |
|
|
| 194 |
|
$this->replacer->modify($file, ['toText' => 'pants']); |
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
public function testCallingModifyWithNoToTextThrowsInvalidArgumentsException() |
| 198 |
|
{ |
|
@@ 197-205 (lines=9) @@
|
| 194 |
|
$this->replacer->modify($file, ['toText' => 'pants']); |
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
public function testCallingModifyWithNoToTextThrowsInvalidArgumentsException() |
| 198 |
|
{ |
| 199 |
|
$this->expectException(InvalidArgumentException::class); |
| 200 |
|
|
| 201 |
|
$file = new LocalFile(static::$dir . 'simple_replace.test'); |
| 202 |
|
$file->put('some text that text should be replaced'); |
| 203 |
|
|
| 204 |
|
$this->replacer->modify($file, ['fromText' => 'pants']); |
| 205 |
|
} |
| 206 |
|
|
| 207 |
|
public function testCallingModifyWithANonLocalFileWillThrowAnException() |
| 208 |
|
{ |