diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-01 22:29:51 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-01 22:29:51 -0400 |
commit | c2d15e6c3bd8a29bae89d184a999ddac15fcb807 (patch) | |
tree | 96cbbfa98f131d830fbfd154f82e37383bb37bd8 /library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php | |
parent | b1ae4d776c7c093c7f3ff6905e1a5302fbd5e3f6 (diff) | |
download | volse-hubzilla-c2d15e6c3bd8a29bae89d184a999ddac15fcb807.tar.gz volse-hubzilla-c2d15e6c3bd8a29bae89d184a999ddac15fcb807.tar.bz2 volse-hubzilla-c2d15e6c3bd8a29bae89d184a999ddac15fcb807.zip |
New plugin repo is cloned to /store/pluginrepos/REPONAME for analysis
Diffstat (limited to 'library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php')
-rwxr-xr-x | library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php new file mode 100755 index 000000000..48967cab1 --- /dev/null +++ b/library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php @@ -0,0 +1,71 @@ +<?php + +use PHPGit\Git; +use Symfony\Component\Filesystem\Filesystem; + +require_once __DIR__ . '/../BaseTestCase.php'; + +class ShortlogCommandTest extends BaseTestCase +{ + + public function testShortlog() + { + $filesystem = new Filesystem(); + + $git = new Git(); + $git->init($this->directory); + $git->setRepository($this->directory); + $git->config->set('user.name', 'Name One'); + $git->config->set('user.email', 'one@example.com'); + $filesystem->dumpFile($this->directory . '/test.txt', ''); + $git->add('test.txt'); + $git->commit('1'); + $filesystem->dumpFile($this->directory . '/test2.txt', ''); + $git->add('test2.txt'); + $git->commit('2'); + + $git->config->set('user.name', 'Name Two'); + $git->config->set('user.email', 'two@example.com'); + $filesystem->dumpFile($this->directory . '/test3.txt', ''); + $git->add('test3.txt'); + $git->commit('3'); + + $shortlog = $git->shortlog(); + + $this->assertCount(2, $shortlog); + $this->assertCount(2, $shortlog['Name One <one@example.com>']); + $this->assertCount(1, $shortlog['Name Two <two@example.com>']); + $this->assertEquals('1', $shortlog['Name One <one@example.com>'][0]['subject']); + } + + public function testShortlogSummary() + { + $filesystem = new Filesystem(); + + $git = new Git(); + $git->init($this->directory); + $git->setRepository($this->directory); + $git->config->set('user.name', 'Name One'); + $git->config->set('user.email', 'one@example.com'); + $filesystem->dumpFile($this->directory . '/test.txt', ''); + $git->add('test.txt'); + $git->commit('1'); + $filesystem->dumpFile($this->directory . '/test2.txt', ''); + $git->add('test2.txt'); + $git->commit('2'); + + $git->config->set('user.name', 'Name Two'); + $git->config->set('user.email', 'two@example.com'); + $filesystem->dumpFile($this->directory . '/test3.txt', ''); + $git->add('test3.txt'); + $git->commit('3'); + + $summary = $git->shortlog->summary(); + + $this->assertEquals(array( + 'Name One <one@example.com>' => 2, + 'Name Two <two@example.com>' => 1 + ), $summary); + } + +}
\ No newline at end of file |