From e5ede671d296edb9debe862360807d72386103a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pr=C3=A9vot?= Date: Sun, 15 Feb 2015 23:20:45 -0400 Subject: [PATCH] Config Git repository user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One can’t assume a Git user is already setup for the tests. --- .../Package/Archiver/ArchivableFilesFinderTest.php | 2 ++ .../Test/Package/Archiver/ArchiveManagerTest.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php index bc74be1e9..e9233f3cb 100644 --- a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php @@ -187,6 +187,8 @@ class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase $this->finder = new ArchivableFilesFinder($this->sources, array()); $this->assertArchivableFiles($this->getArchivedFiles('git init && '. + 'git config user.email "you@example.com" && '. + 'git config user.name "Your Name" && '. 'git add .git* && '. 'git commit -m "ignore rules" && '. 'git add . && '. diff --git a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php index aa98a62a2..f4d343e63 100644 --- a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php @@ -78,6 +78,18 @@ class ArchiveManagerTest extends ArchiverTest throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput()); } + $result = $this->process->execute('git config user.email "you@example.com"', $output, $this->testDir); + if ($result > 0) { + chdir($currentWorkDir); + throw new \RuntimeException('Could not config: '.$this->process->getErrorOutput()); + } + + $result = $this->process->execute('git config user.name "Your Name"', $output, $this->testDir); + if ($result > 0) { + chdir($currentWorkDir); + throw new \RuntimeException('Could not config: '.$this->process->getErrorOutput()); + } + $result = file_put_contents('composer.json', '{"name":"faker/faker", "description": "description", "license": "MIT"}'); if (false === $result) { chdir($currentWorkDir);