Skip to content

Commit

Permalink
Test data provider also now creates a repo with an altertiave .git di…
Browse files Browse the repository at this point in the history
…rectory
  • Loading branch information
chris114782 committed Mar 2, 2023
1 parent 89533fc commit 2694243
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/Gitonomy/Git/Tests/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class AbstractTest extends TestCase
*
* @return Repository
*/
public static function createEmptyRepository($bare = true)
public static function createEmptyRepository($bare = true, $separateGitDir = false)
{
$dir = self::createTempDir();
$repository = Admin::init($dir, $bare, self::getOptions());
Expand All @@ -56,6 +56,7 @@ public static function provideFoobar()
return [
[self::createFoobarRepository()],
[self::createFoobarRepository(false)],
[self::createFoobarRepository(false, true)]
];
}

Expand All @@ -75,10 +76,12 @@ public static function provideEmpty()
*
* @return Repository
*/
public static function createFoobarRepository($bare = true)
public static function createFoobarRepository($bare = true, $separateGitDirectory = false)
{
$args = $separateGitDirectory ? ['--separate-git-dir=' . tempnam(sys_get_temp_dir(), 'gitlib_')] : [];

if (null === self::$localRepository) {
self::$localRepository = Admin::cloneTo(self::createTempDir(), self::REPOSITORY_URL, $bare, self::getOptions());
self::$localRepository = Admin::cloneTo(self::createTempDir(), self::REPOSITORY_URL, $bare, self::getOptions(), $args);
}

$repository = self::$localRepository->cloneTo(self::createTempDir(), $bare, self::getOptions());
Expand Down

0 comments on commit 2694243

Please sign in to comment.