@@ -725,16 +725,26 @@ public function testGetOwnerName(): void
725725 $ repositoryName = 'test-get-owner-name- ' . \uniqid ();
726726 $ created = $ this ->vcsAdapter ->createRepository (self ::$ owner , $ repositoryName , false );
727727
728- $ this ->assertIsArray ($ created );
729- $ this ->assertArrayHasKey ('id ' , $ created );
730- $ this ->assertIsScalar ($ created ['id ' ]);
731- $ repositoryId = (int ) $ created ['id ' ];
728+ try {
729+ $ this ->assertIsArray ($ created );
730+ $ this ->assertArrayHasKey ('id ' , $ created );
731+ $ this ->assertIsScalar ($ created ['id ' ]);
732+ $ repositoryId = (int ) $ created ['id ' ];
732733
733- $ ownerName = $ this ->vcsAdapter ->getOwnerName ('' , $ repositoryId );
734+ $ ownerName = $ this ->vcsAdapter ->getOwnerName ('' , $ repositoryId );
734735
735- $ this ->assertSame (self ::$ owner , $ ownerName );
736+ $ this ->assertSame (self ::$ owner , $ ownerName );
737+ } finally {
738+ $ this ->vcsAdapter ->deleteRepository (self ::$ owner , $ repositoryName );
739+ }
740+ }
736741
737- $ this ->vcsAdapter ->deleteRepository (self ::$ owner , $ repositoryName );
742+ public function testGetOwnerNameWithZeroRepositoryId (): void
743+ {
744+ $ this ->expectException (\Exception::class);
745+ $ this ->expectExceptionMessage ('repositoryId is required for Gitea ' );
746+
747+ $ this ->vcsAdapter ->getOwnerName ('' , 0 );
738748 }
739749
740750 public function testGetOwnerNameWithoutRepositoryId (): void
0 commit comments