File tree Expand file tree Collapse file tree 1 file changed +16
-22
lines changed
build/tests/php/VersionUpdater/Integration Expand file tree Collapse file tree 1 file changed +16
-22
lines changed Original file line number Diff line number Diff line change 1010
1111final class PhelVersionUpdaterTest extends TestCase
1212{
13- /** @var false| resource */
13+ /** @var resource */
1414 private $ file ;
1515
1616 protected function setUp (): void
1717 {
1818 $ this ->file = tmpfile ();
19- fwrite ($ this ->file , 'phel_version = "v.0.9" ' );
19+ fwrite (
20+ $ this ->file ,
21+ <<<TXT
22+ Some random directives
23+ phel_version = "v.0.9"
24+ And more here
25+ TXT
26+ );
2027 }
2128
2229 protected function tearDown (): void
@@ -26,32 +33,19 @@ protected function tearDown(): void
2633
2734 public function test_update_phel_version (): void
2835 {
29- $ consoleFacade = $ this ->createAnonConsoleFacade ();
36+ $ consoleFacade = self ::createStub (ConsoleFacadeInterface::class);
37+ $ consoleFacade ->method ('getVersion ' )->willReturn ('v1.0 ' );
3038
3139 $ path = stream_get_meta_data ($ this ->file )['uri ' ];
3240 $ phelVersionUpdater = new PhelVersionUpdater ($ consoleFacade , $ path );
3341 $ phelVersionUpdater ->update ();
3442
3543 $ content = file_get_contents ($ path );
36-
37- $ expected = 'phel_version = "v1.0" ' ;
38-
44+ $ expected = <<<TXT
45+ Some random directives
46+ phel_version = "v1.0"
47+ And more here
48+ TXT ;
3949 self ::assertSame ($ expected , $ content );
4050 }
41-
42- private function createAnonConsoleFacade (): ConsoleFacadeInterface
43- {
44- return new class implements ConsoleFacadeInterface {
45-
46- public function getVersion (): string
47- {
48- return 'v1.0 ' ;
49- }
50-
51- public function runConsole (): void
52- {
53- // ignore
54- }
55- };
56- }
5751}
You can’t perform that action at this time.
0 commit comments