@@ -138,10 +138,8 @@ public function testGetRepositoryTreeWithSlashInBranchName(): void
138138 $ repositoryName = 'test-branch-with-slash- ' . \uniqid ();
139139 $ this ->vcsAdapter ->createRepository (self ::$ owner , $ repositoryName , false );
140140
141- // Create a file on main branch first
142141 $ this ->createFile (self ::$ owner , $ repositoryName , 'README.md ' , '# Test ' );
143142
144- // Create a branch with a slash in the name using curl
145143 $ giteaUrl = System::getEnv ('TESTS_GITEA_URL ' , 'http://gitea:3000 ' ) ?? '' ;
146144 $ url = "{$ giteaUrl }/api/v1/repos/ " . self ::$ owner . "/ {$ repositoryName }/branches " ;
147145
@@ -156,14 +154,19 @@ public function testGetRepositoryTreeWithSlashInBranchName(): void
156154 'new_branch_name ' => 'feature/test-branch ' ,
157155 'old_branch_name ' => 'main '
158156 ]));
159- curl_exec ($ ch );
157+
158+ $ response = curl_exec ($ ch );
159+ $ httpCode = curl_getinfo ($ ch , CURLINFO_HTTP_CODE );
160160 curl_close ($ ch );
161161
162- // Now try to get tree from the branch with slash
162+ if ($ httpCode >= 400 ) {
163+ throw new \Exception ("Failed to create branch: HTTP {$ httpCode }" );
164+ }
165+
163166 $ tree = $ this ->vcsAdapter ->getRepositoryTree (self ::$ owner , $ repositoryName , 'feature/test-branch ' );
164167
165168 $ this ->assertIsArray ($ tree );
166- $ this ->assertNotEmpty ($ tree ); // Should have README.md
169+ $ this ->assertNotEmpty ($ tree );
167170 $ this ->assertContains ('README.md ' , $ tree );
168171
169172 $ this ->vcsAdapter ->deleteRepository (self ::$ owner , $ repositoryName );
0 commit comments