@@ -67,9 +67,9 @@ protected function setUp(): void
6767 $ this ->filesystem = $ this ->prophesize (FilesystemInterface::class);
6868 $ this ->fileLocator = $ this ->prophesize (FileLocatorInterface::class);
6969
70- $ this ->fileLocator ->locate ('resources/CODEOWNERS.dist ' )
71- ->willReturn ('/package/resources/CODEOWNERS.dist ' );
72- $ this ->filesystem ->readFile ('/package/resources/CODEOWNERS.dist ' )
70+ $ this ->fileLocator ->locate ('resources/CODEOWNERS ' )
71+ ->willReturn ('/package/resources/CODEOWNERS ' );
72+ $ this ->filesystem ->readFile ('/package/resources/CODEOWNERS ' )
7373 ->willReturn (<<<'TEXT'
7474 # Header
7575 {{ suggestions }}
@@ -87,8 +87,10 @@ protected function setUp(): void
8787 * @return void
8888 */
8989 #[Test]
90- public function inferOwnersWillCollectGitHubHandlesFromAuthorHomepages (): void
90+ public function inferOwnersWillCollectGroupAndAuthorOwners (): void
9191 {
92+ $ this ->composerJson ->getSupport ()
93+ ->willReturn (new Support (source: 'https://github.com/php-fast-forward/dev-tools ' ));
9294 $ this ->composerJson ->getAuthors ()
9395 ->willReturn ([
9496 new Author (homepage: 'https://github.com/php-fast-forward ' ),
@@ -103,12 +105,12 @@ public function inferOwnersWillCollectGitHubHandlesFromAuthorHomepages(): void
103105 * @return void
104106 */
105107 #[Test]
106- public function inferSuggestedOwnersWillReturnRepositoryOwnerFromSupportSource (): void
108+ public function inferGroupOwnerWillReturnRepositoryOwnerFromSupportSource (): void
107109 {
108110 $ this ->composerJson ->getSupport ()
109111 ->willReturn (new Support (source: 'https://github.com/php-fast-forward/dev-tools ' ));
110112
111- self ::assertSame ([ '@php-fast-forward ' ] , $ this ->generator ->inferSuggestedOwners ());
113+ self ::assertSame ('@php-fast-forward ' , $ this ->generator ->inferGroupOwner ());
112114 }
113115
114116 /**
@@ -117,28 +119,42 @@ public function inferSuggestedOwnersWillReturnRepositoryOwnerFromSupportSource()
117119 #[Test]
118120 public function generateWillRenderExplicitOwners (): void
119121 {
122+ self ::assertSame (
123+ "# Header \n\n* @php-fast-forward @mentordosnerds " ,
124+ $ this ->generator ->generate (['@php-fast-forward ' , '@mentordosnerds ' ]),
125+ );
126+ }
127+
128+ /**
129+ * @return void
130+ */
131+ #[Test]
132+ public function generateWillRenderCommentedFallbackWhenOwnersCannotBeInferred (): void
133+ {
134+ $ this ->composerJson ->getAuthors ()
135+ ->willReturn ([]);
120136 $ this ->composerJson ->getSupport ()
121137 ->willReturn (new Support ());
122138
123139 self ::assertSame (
124- "# Header \n# No GitHub owners could be inferred from composer.json metadata. \n* @php-fast-forward @mentordosnerds " ,
125- $ this ->generator ->generate ([ ' @php-fast-forward ' , ' @mentordosnerds ' ] ),
140+ "# Header \n# No GitHub owners could be inferred from composer.json metadata. \n# * @your-github-user " ,
141+ $ this ->generator ->generate (),
126142 );
127143 }
128144
129145 /**
130146 * @return void
131147 */
132148 #[Test]
133- public function generateWillRenderCommentedFallbackWhenOwnersCannotBeInferred (): void
149+ public function generateWillRenderGroupOwnerWhenAuthorCannotBeInferred (): void
134150 {
135151 $ this ->composerJson ->getAuthors ()
136152 ->willReturn ([]);
137153 $ this ->composerJson ->getSupport ()
138154 ->willReturn (new Support (source: 'https://github.com/php-fast-forward/dev-tools ' ));
139155
140156 self ::assertSame (
141- "# Header \n# Suggested owner from composer support metadata: @php-fast-forward \n # * @your-github-user " ,
157+ "# Header \n\n * @php-fast-forward " ,
142158 $ this ->generator ->generate (),
143159 );
144160 }
0 commit comments