| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 14 | class ReplaceProjectRootNamespaceProcessTest extends TestCase |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @test |
||
| 18 | */ |
||
| 19 | public function itCanReplaceTheProjectRootNamespace() |
||
| 20 | { |
||
| 21 | $file = new File(); |
||
| 22 | $file->setContents( |
||
| 23 | 'namespace ' . ReplaceProjectRootNamespaceProcess::FIND_NAMESPACE . 'Blah; |
||
| 24 | use ' . ReplaceProjectRootNamespaceProcess::FIND_NAMESPACE . 'Something' |
||
| 25 | ); |
||
| 26 | $rootNamespace = 'My\\Test\\Project\\'; |
||
| 27 | $this->getProcess()->setProjectRootNamespace($rootNamespace)->run(new FindReplace($file)); |
||
| 28 | $expected = 'namespace ' . $rootNamespace . 'Blah; |
||
| 29 | use ' . $rootNamespace . 'Something'; |
||
| 30 | $actual = $file->getContents(); |
||
| 31 | self::assertSame($expected, $actual); |
||
| 32 | } |
||
| 33 | |||
| 34 | private function getProcess(): ReplaceProjectRootNamespaceProcess |
||
| 35 | { |
||
| 36 | return new ReplaceProjectRootNamespaceProcess(); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @test |
||
| 41 | */ |
||
| 42 | public function throwsAnExceptionIfNoNamespaceSet() |
||
| 47 | } |
||
| 48 | } |
||
| 49 |