77use Laminas \AutomaticReleases \Git \HasTag ;
88use Laminas \AutomaticReleases \Git \HasTagViaConsole ;
99use PHPUnit \Framework \TestCase ;
10+ use Psl \Env ;
11+ use Psl \Filesystem ;
12+ use Psl \Shell ;
1013
1114use function array_map ;
12- use function Psl \Env \temp_dir ;
13- use function Psl \Filesystem \create_directory ;
14- use function Psl \Filesystem \create_temporary_file ;
15- use function Psl \Filesystem \delete_file ;
16- use function Psl \Shell \execute ;
1715use function sprintf ;
1816
1917/** @covers \Laminas\AutomaticReleases\Git\HasTagViaConsole */
@@ -27,17 +25,17 @@ protected function setUp(): void
2725 {
2826 parent ::setUp ();
2927
30- $ this ->repository = create_temporary_file (temp_dir (), 'HasTagViaConsoleRepository ' );
28+ $ this ->repository = Filesystem \ create_temporary_file (Env \ temp_dir (), 'HasTagViaConsoleRepository ' );
3129
3230 $ this ->hasTag = new HasTagViaConsole ();
3331
34- delete_file ($ this ->repository );
35- create_directory ($ this ->repository );
32+ Filesystem \ delete_file ($ this ->repository );
33+ Filesystem \ create_directory ($ this ->repository );
3634
37- execute ('git ' , ['init ' ], $ this ->repository );
35+ Shell \ execute ('git ' , ['init ' ], $ this ->repository );
3836
39- execute ('git ' , ['config ' , 'user.email ' , 'me@example.com ' ], $ this ->repository );
40- execute ('git ' , ['config ' , 'user.name ' , 'Just Me ' ], $ this ->repository );
37+ Shell \ execute ('git ' , ['config ' , 'user.email ' , 'me@example.com ' ], $ this ->repository );
38+ Shell \ execute ('git ' , ['config ' , 'user.name ' , 'Just Me ' ], $ this ->repository );
4139
4240 array_map (fn (string $ tag ) => $ this ->createTag ($ tag ), [
4341 '1.0.0 ' ,
@@ -47,29 +45,35 @@ protected function setUp(): void
4745
4846 private function createTag (string $ tag ): void
4947 {
50- execute ('git ' , ['commit ' , '--allow-empty ' , '-m ' , 'a commit for version ' . $ tag ], $ this ->repository );
51- execute ('git ' , ['tag ' , '-a ' , $ tag , '-m ' , 'version ' . $ tag ], $ this ->repository );
48+ Shell \ execute ('git ' , ['commit ' , '--allow-empty ' , '-m ' , 'a commit for version ' . $ tag ], $ this ->repository );
49+ Shell \ execute ('git ' , ['tag ' , '-a ' , $ tag , '-m ' , 'version ' . $ tag ], $ this ->repository );
5250 }
5351
54- /** @param non-empty-string $repository */
52+ /**
53+ * @param non-empty-string $repository
54+ * @param non-empty-string $tag
55+ */
5556 private function assertGitTagExists (string $ repository , string $ tag ): void
5657 {
5758 self ::assertTrue (($ this ->hasTag )($ repository , $ tag ), sprintf ('Failed asserting git tag "%s" exists. ' , $ tag ));
5859 }
5960
60- /** @param non-empty-string $repository */
61+ /**
62+ * @param non-empty-string $repository
63+ * @param non-empty-string $tag
64+ */
6165 private function assertGitTagMissing (string $ repository , string $ tag ): void
6266 {
6367 self ::assertFalse (($ this ->hasTag )($ repository , $ tag ), sprintf ('Failed asserting git tag "%s" is missing. ' , $ tag ));
6468 }
6569
6670 public function testHasTag (): void
6771 {
68- self :: assertGitTagExists ($ this ->repository , '1.0.0 ' );
72+ $ this -> assertGitTagExists ($ this ->repository , '1.0.0 ' );
6973 }
7074
7175 public function testHasTagMissing (): void
7276 {
73- self :: assertGitTagMissing ($ this ->repository , '10.0.0 ' );
77+ $ this -> assertGitTagMissing ($ this ->repository , '10.0.0 ' );
7478 }
7579}
0 commit comments