diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-10-09 21:02:08 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-10-09 21:02:08 +0200 |
commit | 2ed8908127f44a2a8d1326791e40668a425b7787 (patch) | |
tree | dd8ca46047647bfc40a57db6f502a9f66c71ae8d /library/kzykhys/git/test | |
parent | 6588e272db9e797447430f9f3853d365c56606eb (diff) | |
download | volse-hubzilla-2ed8908127f44a2a8d1326791e40668a425b7787.tar.gz volse-hubzilla-2ed8908127f44a2a8d1326791e40668a425b7787.tar.bz2 volse-hubzilla-2ed8908127f44a2a8d1326791e40668a425b7787.zip |
Remove now unused PHPGit from library.
Diffstat (limited to 'library/kzykhys/git/test')
29 files changed, 0 insertions, 1761 deletions
diff --git a/library/kzykhys/git/test/PHPGit/BaseTestCase.php b/library/kzykhys/git/test/PHPGit/BaseTestCase.php deleted file mode 100644 index df69b216e..000000000 --- a/library/kzykhys/git/test/PHPGit/BaseTestCase.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -use Symfony\Component\Filesystem\Filesystem; - -/** - * @author Kazuyuki Hayashi <hayashi@siance.co.jp> - */ -abstract class BaseTestCase extends PHPUnit_Framework_TestCase -{ - - /** - * @var string - */ - protected $directory; - - /** - * {@inheritdoc} - */ - public function setUp() - { - $this->directory = __DIR__.'/../../build/' . strtolower(get_class($this)); - } - - /** - * {@inheritdoc} - */ - public function tearDown() - { - $filesystem = new Filesystem(); - $filesystem->remove($this->directory); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/AddCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/AddCommandTest.php deleted file mode 100644 index 1fad08417..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/AddCommandTest.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -/** - * @author Kazuyuki Hayashi <hayashi@valnur.net> - */ -class AddCommandTest extends BaseTestCase -{ - - public function testAdd() - { - $filesystem = new Filesystem(); - $filesystem->mkdir($this->directory); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $filesystem->dumpFile($this->directory . '/test.md', '**foo**'); - - $this->assertTrue($git->add('test.txt')); - $this->assertTrue($git->add(array('test.md'), array('force' => true))); - } - - /** - * @expectedException \PHPGit\Exception\GitException - * @expectedExceptionCode 128 - */ - public function testException() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->add('foo'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/ArchiveCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/ArchiveCommandTest.php deleted file mode 100644 index 982c8f7c7..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/ArchiveCommandTest.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -/** - * @author Kazuyuki Hayashi <hayashi@valnur.net> - */ -class ArchiveCommandTest extends BaseTestCase -{ - - public function testArchive() - { - $filesystem = new Filesystem(); - $filesystem->mkdir($this->directory); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'hello'); - $git->add('test.txt'); - $git->commit('Initial commit'); - - $git->archive($this->directory . '/test.zip', 'master', null, array('format' => 'zip', 'prefix' => 'test/')); - - $this->assertFileExists($this->directory . '/test.zip'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/BranchCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/BranchCommandTest.php deleted file mode 100644 index 4deeea367..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/BranchCommandTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class BranchCommandTest extends BaseTestCase -{ - - public function setUp() - { - parent::setUp(); - - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', ''); - $git->add('test.txt'); - $git->commit('Initial commit'); - } - - public function testBranch() - { - $git = new Git(); - $git->setRepository($this->directory); - - $branches = $git->branch(); - - $this->assertCount(1, $branches); - $this->assertEquals('master', $branches['master']['name']); - $this->assertTrue($branches['master']['current']); - $this->assertEquals('Initial commit', $branches['master']['title']); - } - - public function testAllBranch() - { - $git = new Git(); - $git->clone('file://' . realpath($this->directory), $this->directory.'2'); - $git->setRepository($this->directory.'2'); - - $branches = $git->branch(array('remotes' => true)); - $this->assertArrayHasKey('origin/master', $branches); - - $branches = $git->branch(array('all' => true)); - $this->assertArrayHasKey('master', $branches); - $this->assertArrayHasKey('remotes/origin/master', $branches); - - $filesystem = new Filesystem(); - $filesystem->remove($this->directory.'2'); - } - - public function testBranchCreate() - { - $git = new Git(); - $git->setRepository($this->directory); - - $git->branch->create('1.0'); - $branches = $git->branch(); - $this->assertCount(2, $branches); - - $git->branch->create('1.0-fix', '1.0', array('force' => true)); - $branches = $git->branch(); - $this->assertCount(3, $branches); - $this->assertArrayHasKey('1.0', $branches); - $this->assertArrayHasKey('1.0-fix', $branches); - } - - public function testBranchMove() - { - $git = new Git(); - $git->setRepository($this->directory); - $git->branch->create('1.0'); - $git->branch->move('1.0', '1.0.x'); - $branches = $git->branch(); - $this->assertCount(2, $branches); - $this->assertArrayHasKey('1.0.x', $branches); - - $git->branch->move('1.0.x', '2.x', array('force' => true)); - $branches = $git->branch(); - $this->assertCount(2, $branches); - $this->assertArrayHasKey('2.x', $branches); - } - - public function testBranchDelete() - { - $git = new Git(); - $git->setRepository($this->directory); - $git->branch->create('1.0'); - $git->branch->create('2.0'); - $branches = $git->branch(); - $this->assertCount(3, $branches); - - $git->branch->delete('1.0'); - $branches = $git->branch(); - $this->assertCount(2, $branches); - - $git->branch->delete('2.0', array('force' => true)); - $branches = $git->branch(); - $this->assertCount(1, $branches); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/CatCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/CatCommandTest.php deleted file mode 100644 index 945924ccb..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/CatCommandTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class CatCommandTest extends BaseTestCase -{ - - public function testCatBlob() - { - $filesystem = new Filesystem(); - $filesystem->mkdir($this->directory); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('Initial commit'); - - $tree = $git->tree(); - - $this->assertEquals('foo', $git->cat->blob($tree[0]['hash'])); - } - - public function testCatType() - { - $filesystem = new Filesystem(); - $filesystem->mkdir($this->directory); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('Initial commit'); - - $tree = $git->tree(); - - $this->assertEquals('blob', $git->cat->type($tree[0]['hash'])); - } - - public function testCatSize() - { - $filesystem = new Filesystem(); - $filesystem->mkdir($this->directory); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('Initial commit'); - - $tree = $git->tree(); - - $this->assertEquals(3, $git->cat->size($tree[0]['hash'])); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php deleted file mode 100644 index c306ea407..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class CheckoutCommandTest extends BaseTestCase -{ - - public function setUp() - { - parent::setUp(); - - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', ''); - $git->add('test.txt'); - $git->commit('Initial commit'); - } - - public function testCheckout() - { - $git = new Git(); - $git->setRepository($this->directory); - $git->branch->create('next'); - $git->checkout('next'); - - $branches = $git->branch(); - $this->assertArrayHasKey('next', $branches); - $this->assertTrue($branches['next']['current']); - } - - public function testCheckoutCreate() - { - $git = new Git(); - $git->setRepository($this->directory); - $git->checkout->create('next'); - - $branches = $git->branch(); - $this->assertArrayHasKey('next', $branches); - $this->assertTrue($branches['next']['current']); - - $git->checkout->create('develop', 'next'); - - $branches = $git->branch(); - $this->assertArrayHasKey('develop', $branches); - $this->assertTrue($branches['develop']['current']); - } - - public function testCheckoutOrphan() - { - $git = new Git(); - $git->setRepository($this->directory); - $git->checkout->orphan('gh-pages', 'master', array('force' => true)); - - $status = $git->status(); - $this->assertEquals('gh-pages', $status['branch']); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/CloneCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/CloneCommandTest.php deleted file mode 100644 index d6a4d26ff..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/CloneCommandTest.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class CloneCommandTest extends BaseTestCase -{ - - public function testClone() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $this->assertFileExists($this->directory . '/.git'); - - $filesystem = new Filesystem(); - $filesystem->remove($this->directory); - - $git->setRepository('.'); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory, array('shared' => true)); - - $this->assertFileExists($this->directory . '/.git'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/CommitCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/CommitCommandTest.php deleted file mode 100644 index 01b50ad8d..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/CommitCommandTest.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class CommitCommandTest extends BaseTestCase -{ - - public function testCommit() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem = new Filesystem(); - $filesystem->dumpFile($this->directory . '/test.txt', ''); - $git->add('test.txt'); - $git->commit('Initial commit'); - $logs = $git->log('test.txt'); - - $this->assertCount(1, $logs); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/ConfigCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/ConfigCommandTest.php deleted file mode 100644 index fba2fbf76..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/ConfigCommandTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class ConfigCommandTest extends BaseTestCase -{ - - public function testConfigSetAndList() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $before = $git->config(); - - $git->config->set('user.name', 'John Doe'); - - $config = $git->config(); - $this->assertArrayHasKey('user.name', $config); - - $expected = 'John Doe'; - - if (isset($before['user.name'])) { - $expected = $before['user.name'] . "\n" . $expected; - } - - $this->assertEquals($expected, $config['user.name']); - } - - public function testConfigAdd() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $before = $git->config(); - - $git->config->set('user.name', 'John Doe'); - $git->config->add('user.name', 'Foo'); - - $config = $git->config(); - $this->assertArrayHasKey('user.name', $config); - - $expected = "John Doe\nFoo"; - - if (isset($before['user.name'])) { - $expected = $before['user.name'] . "\n" . $expected; - } - - $this->assertEquals($expected, $config['user.name']); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/DescribeCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/DescribeCommandTest.php deleted file mode 100644 index 04d3bd3b0..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/DescribeCommandTest.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class DescribeCommandTest extends BaseTestCase -{ - - public function testDescribeTags() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('README.md'); - $git->commit('Initial commit'); - $git->tag->create('v1.0.0'); - $version = $git->describe->tags('HEAD'); - - $this->assertEquals('v1.0.0', $version); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello2'); - $git->add('README.md'); - $git->commit('Fixes README'); - $version = $git->describe->tags('HEAD'); - - $this->assertStringStartsWith('v1.0.0', $version); - $this->assertStringEndsNotWith('v1.0.0', $version); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/FetchCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/FetchCommandTest.php deleted file mode 100644 index f52943099..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/FetchCommandTest.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class FetchCommandTest extends BaseTestCase -{ - - public function testFetch() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->fetch('origin', '+refs/heads/*:refs/remotes/origin/*'); - - $tags = $git->tag(); - $this->assertContains('v1.0.0', $tags); - } - - public function testFetchAll() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->fetch->all(); - - $tags = $git->tag(); - $this->assertContains('v1.0.0', $tags); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/MergeCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/MergeCommandTest.php deleted file mode 100644 index 208461523..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/MergeCommandTest.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class MergeCommandTest extends BaseTestCase -{ - - public function testMerge() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('master'); - - $git->checkout->create('develop'); - $filesystem->dumpFile($this->directory . '/test.txt', 'bar'); - $git->add('test.txt'); - $git->commit('develop'); - - $git->checkout('master'); - - $this->assertEquals('foo', file_get_contents($this->directory . '/test.txt')); - - $git->merge('develop'); - - $this->assertEquals('bar', file_get_contents($this->directory . '/test.txt')); - } - - /** - * @expectedException \PHPGit\Exception\GitException - */ - public function testMergeFail() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - // branch:master - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('master'); - - // branch:develop - $git->checkout->create('develop'); - $filesystem->dumpFile($this->directory . '/test.txt', 'bar'); - $git->add('test.txt'); - $git->commit('develop'); - - // branch:master - $git->checkout('master'); - $filesystem->dumpFile($this->directory . '/test.txt', 'baz'); - $git->merge('develop'); - } - - public function testMergeAbort() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - // branch:master - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('master'); - - // branch:develop - $git->checkout->create('develop'); - $filesystem->dumpFile($this->directory . '/test.txt', 'bar'); - $git->add('test.txt'); - $git->commit('develop'); - - // branch:master - $git->checkout('master'); - $filesystem->dumpFile($this->directory . '/test.txt', 'baz'); - $git->add('test.txt'); - $git->commit('master'); - - try { - $git->merge('develop'); - $this->fail('$git->merge("develop") should fail'); - } catch (Exception $e) { - } - - $git->merge->abort(); - - $this->assertEquals('baz', file_get_contents($this->directory . '/test.txt')); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/MvCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/MvCommandTest.php deleted file mode 100644 index dd5f46c55..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/MvCommandTest.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class MvCommandTest extends BaseTestCase -{ - - public function testMv() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('Initial commit'); - $git->mv('test.txt', 'test2.txt'); - - $this->assertFileExists($this->directory . '/test2.txt'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/PullCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/PullCommandTest.php deleted file mode 100644 index 89dec75a9..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/PullCommandTest.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class PullCommandTest extends BaseTestCase -{ - - public function testPull() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->pull('origin', 'master'); - - $this->assertFileExists($this->directory . '/README.md'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/PushCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/PushCommandTest.php deleted file mode 100644 index 11424cebc..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/PushCommandTest.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class PushCommandTest extends BaseTestCase -{ - - public function testPush() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory, array('shared' => true, 'bare' => true)); - - $git->clone('file://' . realpath($this->directory), $this->directory.'2'); - $git->setRepository($this->directory.'2'); - - $filesystem->dumpFile($this->directory.'2/test.txt', 'foobar'); - $git->add('test.txt'); - $git->commit('test'); - $git->push('origin', 'master'); - - $git->clone('file://' . realpath($this->directory), $this->directory.'3'); - - $this->assertFileExists($this->directory.'3/test.txt'); - - $filesystem->remove($this->directory.'2'); - $filesystem->remove($this->directory.'3'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/RebaseCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/RebaseCommandTest.php deleted file mode 100644 index af7e87a19..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/RebaseCommandTest.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class RebaseCommandTest extends BaseTestCase -{ - - public function testRebase() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', '123'); - $git->add('test.txt'); - $git->commit('initial commit'); - - $git->checkout->create('next'); - $filesystem->dumpFile($this->directory . '/test2.txt', '123'); - $git->add('test2.txt'); - $git->commit('test'); - - $git->checkout('master'); - $git->rebase('next', 'master'); - - $this->assertFileExists($this->directory. '/test2.txt'); - } - - public function testRebaseOnto() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/test.txt', '123'); - $git->add('test.txt'); - $git->commit('initial commit'); - - $git->checkout->create('next'); - $filesystem->dumpFile($this->directory . '/test2.txt', '123'); - $git->add('test2.txt'); - $git->commit('test'); - - $git->checkout->create('topic', 'next'); - $filesystem->dumpFile($this->directory . '/test3.txt', '123'); - $git->add('test3.txt'); - $git->commit('test'); - - $git->rebase('next', null, array('onto' => 'master')); - $this->assertFileNotExists($this->directory . '/test2.txt'); - } - - public function testRebaseContinue() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('initial commit'); - - $git->checkout->create('next'); - $filesystem->dumpFile($this->directory . '/test.txt', 'bar'); - $git->add('test.txt'); - $git->commit('next commit'); - - $git->checkout('master'); - $filesystem->dumpFile($this->directory . '/test.txt', 'baz'); - $git->add('test.txt'); - $git->commit('master commit'); - - try { - $git->rebase('next'); - $this->fail('GitException should be thrown'); - } catch (\PHPGit\Exception\GitException $e) { - } - - $filesystem->dumpFile($this->directory . '/test.txt', 'foobar'); - $git->add('test.txt'); - $git->rebase->continues(); - } - - public function testRebaseAbort() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('initial commit'); - - $git->checkout->create('next'); - $filesystem->dumpFile($this->directory . '/test.txt', 'bar'); - $git->add('test.txt'); - $git->commit('next commit'); - - $git->checkout('master'); - $filesystem->dumpFile($this->directory . '/test.txt', 'baz'); - $git->add('test.txt'); - $git->commit('master commit'); - - try { - $git->rebase('next'); - $this->fail('GitException should be thrown'); - } catch (\PHPGit\Exception\GitException $e) { - } - - $git->rebase->abort(); - } - - public function testRebaseSkip() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', 'foo'); - $git->add('test.txt'); - $git->commit('initial commit'); - - $git->checkout->create('next'); - $filesystem->dumpFile($this->directory . '/test.txt', 'bar'); - $git->add('test.txt'); - $git->commit('next commit'); - - $git->checkout('master'); - $filesystem->dumpFile($this->directory . '/test.txt', 'baz'); - $git->add('test.txt'); - $git->commit('master commit'); - - try { - $git->rebase('next'); - $this->fail('GitException should be thrown'); - } catch (\PHPGit\Exception\GitException $e) { - } - - $git->rebase->skip(); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/Remote/SetBranchesCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/Remote/SetBranchesCommandTest.php deleted file mode 100644 index 4f428f832..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/Remote/SetBranchesCommandTest.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../../BaseTestCase.php'; - -class SetBranchesCommandTest extends BaseTestCase -{ - - public function testSetBranches() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $git->remote->branches('origin', array('master')); - } - - public function testSetBranchesAdd() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $git->remote->branches->add('origin', array('gh-pages')); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/Remote/SetHeadCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/Remote/SetHeadCommandTest.php deleted file mode 100644 index 679c2976f..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/Remote/SetHeadCommandTest.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../../BaseTestCase.php'; - -class SetHeadCommandTest extends BaseTestCase -{ - - public function testSetHead() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $before = $git->branch(array('all' => true)); - - $git->remote->head('origin', 'master'); - - $after = $git->branch(array('all' => true)); - - $this->assertEquals($before, $after); - } - - public function testSetHeadDelete() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $before = $git->branch(array('all' => true)); - - $git->remote->head->delete('origin'); - - $after = $git->branch(array('all' => true)); - - $this->assertNotEquals($before, $after); - } - - public function testSetHeadRemote() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $before = $git->branch(array('all' => true)); - - $git->remote->head->delete('origin'); - $git->remote->head->remote('origin'); - - $after = $git->branch(array('all' => true)); - - $this->assertEquals($before, $after); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/Remote/SetUrlCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/Remote/SetUrlCommandTest.php deleted file mode 100644 index b70b67d40..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/Remote/SetUrlCommandTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../../BaseTestCase.php'; - -class SetUrlCommandTest extends BaseTestCase -{ - - public function testSetUrl() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'http://example.com/test.git'); - $git->remote->url('origin', 'https://github.com/kzykhys/Text.git', 'http://example.com/test.git'); - - $remotes = $git->remote(); - - $this->assertEquals('https://github.com/kzykhys/Text.git', $remotes['origin']['fetch']); - } - - public function testSetUrlAdd() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'http://example.com/test.git'); - $git->remote->url->add('origin', 'https://github.com/kzykhys/Text.git'); - } - - public function testSetUrlDelete() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'http://example.com/test.git'); - $git->remote->url->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->remote->url->delete('origin', 'https://github.com'); - - $remotes = $git->remote(); - - $this->assertEquals('http://example.com/test.git', $remotes['origin']['fetch']); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/RemoteCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/RemoteCommandTest.php deleted file mode 100644 index 78aa81309..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/RemoteCommandTest.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php - -use PHPGit\Git; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class RemoteCommandTest extends BaseTestCase -{ - - public function testRemote() - { - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $remotes = $git->remote(); - - $this->assertEquals(array( - 'origin' => array( - 'fetch' => 'https://github.com/kzykhys/Text.git', - 'push' => 'https://github.com/kzykhys/Text.git' - ) - ), $remotes); - } - - public function testRemoteAdd() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - - $remotes = $git->remote(); - - $this->assertEquals(array( - 'origin' => array( - 'fetch' => 'https://github.com/kzykhys/Text.git', - 'push' => 'https://github.com/kzykhys/Text.git' - ) - ), $remotes); - } - - public function testRemoteRename() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->remote->rename('origin', 'upstream'); - - $remotes = $git->remote(); - $this->assertEquals(array( - 'upstream' => array( - 'fetch' => 'https://github.com/kzykhys/Text.git', - 'push' => 'https://github.com/kzykhys/Text.git' - ) - ), $remotes); - } - - public function testRemoteRm() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->remote->rm('origin'); - - $remotes = $git->remote(); - $this->assertEquals(array(), $remotes); - } - - public function testRemoteShow() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - - $this->assertNotEmpty($git->remote->show('origin')); - } - - public function testRemotePrune() - { - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); - $git->remote->prune('origin'); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testBadMethodCall() - { - $git = new Git(); - $git->remote->foo(); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/ResetCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/ResetCommandTest.php deleted file mode 100644 index 777e48512..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/ResetCommandTest.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - - -class ResetCommandTest extends BaseTestCase -{ - - public function testReset() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('README.md'); - - $git->reset('README.md', 'HEAD'); - } - - public function testResetSoft() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - - $git->reset->soft(); - } - - public function testResetMixed() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - - $git->reset->mixed(); - } - - public function testResetHard() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - - $git->reset->hard('HEAD'); - } - - public function testResetMerge() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - - $git->reset->merge(); - } - - public function testResetKeep() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - - $git->reset->keep(); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testResetInvalidMode() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - - $git->reset->mode('foo'); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/RmCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/RmCommandTest.php deleted file mode 100644 index 34996cc12..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/RmCommandTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class RmCommandTest extends BaseTestCase -{ - - public function testRm() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $filesystem->dumpFile($this->directory . '/bin/test.php', 'foo'); - $git->add(array('README.md', 'bin/test.php')); - $git->commit('Initial commit'); - - $git->rm('README.md'); - $git->rm('bin', array('recursive' => true)); - - $this->assertFileNotExists($this->directory . '/README.md'); - } - - public function testRmCached() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/README.md', 'foo'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $git->rm->cached('README.md'); - $git->commit('Delete README.md'); - - $this->assertFileExists($this->directory . '/README.md'); - - $tree = $git->tree(); - $this->assertEquals(array(), $tree); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php deleted file mode 100644 index 48967cab1..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/ShortlogCommandTest.php +++ /dev/null @@ -1,71 +0,0 @@ -<?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 diff --git a/library/kzykhys/git/test/PHPGit/Command/ShowCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/ShowCommandTest.php deleted file mode 100644 index 25b22fe4f..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/ShowCommandTest.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class ShowCommandTest extends BaseTestCase -{ - - public function testShow() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/README.md', 'foobar'); - $git->add('README.md'); - $git->commit('Initial commit'); - - $git->show('master', array('format' => 'oneline')); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/StashCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/StashCommandTest.php deleted file mode 100644 index bb87e48ea..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/StashCommandTest.php +++ /dev/null @@ -1,204 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class StashCommandTest extends BaseTestCase -{ - - public function testStash() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - - $this->assertEquals('hello', file_get_contents($this->directory.'/README.md')); - } - - public function testStashSave() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash->save('stash test'); - - $this->assertEquals('hello', file_get_contents($this->directory.'/README.md')); - } - - public function testStashList() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - - $stashes = $git->stash->lists(); - - $this->assertCount(1, $stashes); - $this->assertEquals('master', $stashes[0]['branch']); - $this->assertStringEndsWith('Initial commit', $stashes[0]['message']); - } - - public function testStashShow() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - $git->stash->show('stash@{0}'); - } - - public function testStashDrop() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - $git->stash->drop(); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - $git->stash->drop('stash@{0}'); - - $this->assertCount(0, $git->stash->lists()); - } - - public function testStashPop() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash->save('stash#1'); - - $filesystem->dumpFile($this->directory . '/README.md', 'bar'); - $git->stash->save('stash#2'); - $git->stash->pop('stash@{1}'); - - $this->assertEquals('hi!', file_get_contents($this->directory.'/README.md')); - $this->assertCount(1, $git->stash->lists()); - } - - public function testStashApply() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash->save('stash#1'); - - $filesystem->dumpFile($this->directory . '/README.md', 'bar'); - $git->stash->save('stash#2'); - $git->stash->apply('stash@{1}'); - - $this->assertEquals('hi!', file_get_contents($this->directory.'/README.md')); - $this->assertCount(2, $git->stash->lists()); - } - - public function testStashBranch() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - - $git->stash->branch('dev', 'stash@{0}'); - $status = $git->status(); - - $this->assertEquals('dev', $status['branch']); - $this->assertEquals('hi!', file_get_contents($this->directory.'/README.md')); - } - - public function testStashClear() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $git->stash(); - $git->stash->clear(); - - $this->assertCount(0, $git->stash->lists()); - } - - public function testStashCreate() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - - $filesystem->dumpFile($this->directory . '/README.md', 'hi!'); - $object = $git->stash->create(); - - $this->assertNotEmpty($object); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/StatusCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/StatusCommandTest.php deleted file mode 100644 index ad04a74c0..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/StatusCommandTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -use PHPGit\Command\StatusCommand; -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class StatusCommandTest extends BaseTestCase -{ - - public function testStatus() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/item1.txt', '1'); - $filesystem->dumpFile($this->directory . '/item2.txt', '2'); - $filesystem->dumpFile($this->directory . '/item3.txt', '3'); - - $git->add('item1.txt'); - $git->add('item2.txt'); - - $filesystem->dumpFile($this->directory . '/item1.txt', '1-1'); - - $status = $git->status(); - - $this->assertEquals(array( - 'branch' => 'master', - 'changes' => array( - array('file' => 'item1.txt', 'index' => StatusCommand::ADDED, 'work_tree' => StatusCommand::MODIFIED), - array('file' => 'item2.txt', 'index' => StatusCommand::ADDED, 'work_tree' => StatusCommand::UNMODIFIED), - array('file' => 'item3.txt', 'index' => StatusCommand::UNTRACKED, 'work_tree' => StatusCommand::UNTRACKED), - ) - ), $status); - } - - public function testDetachedHeadStatus() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/item1.txt', '1'); - $git->add('item1.txt'); - $git->commit('initial commit'); - $logs = $git->log(); - $hash = $logs[0]['hash']; - - $git->checkout($hash); - $status = $git->status(); - $this->assertEquals(null, $status['branch']); - } - - public function testTrackingBranchStatus() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->clone('https://github.com/kzykhys/Text.git', $this->directory); - $git->setRepository($this->directory); - - $filesystem->dumpFile($this->directory . '/test.txt', '1'); - $git->add('test.txt'); - $git->commit('test'); - - $status = $git->status(); - $this->assertEquals('master', $status['branch']); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Command/TagCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/TagCommandTest.php deleted file mode 100644 index 5715ba92e..000000000 --- a/library/kzykhys/git/test/PHPGit/Command/TagCommandTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -use PHPGit\Git; -use Symfony\Component\Filesystem\Filesystem; - -require_once __DIR__ . '/../BaseTestCase.php'; - -class TagCommandTest extends BaseTestCase -{ - - public function testTagDelete() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - $git->tag->create('v1.0.0'); - $git->tag->delete('v1.0.0'); - $this->assertCount(0, $git->tag()); - } - - /** - * @expectedException \PHPGit\Exception\GitException - */ - public function testTagVerify() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - $git->tag->create('v1.0.0'); - $git->tag->verify('v1.0.0'); - } - - public function testCreateTagFromCommit() - { - $filesystem = new Filesystem(); - - $git = new Git(); - $git->init($this->directory); - $git->setRepository($this->directory); - $filesystem->dumpFile($this->directory . '/README.md', 'hello'); - $git->add('.'); - $git->commit('Initial commit'); - $log = $git->log(null, null, array('limit' => 1)); - $git->tag->create('v1.0.0', $log[0]['hash']); - $this->assertCount(1, $git->tag()); - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/Exception/GitExceptionTest.php b/library/kzykhys/git/test/PHPGit/Exception/GitExceptionTest.php deleted file mode 100644 index 154d6b906..000000000 --- a/library/kzykhys/git/test/PHPGit/Exception/GitExceptionTest.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -use PHPGit\Exception\GitException; -use PHPGit\Git; - -class GitExceptionTest extends PHPUnit_Framework_TestCase -{ - - public function testException() - { - $git = new Git(); - $git->setRepository(sys_get_temp_dir()); - try { - $git->status(); - $this->fail('Previous operation should fail'); - } catch (GitException $e) { - $command = $e->getCommandLine(); - $command = str_replace(array('"', "'"), '', $command); - $this->assertStringEndsWith('status --porcelain -s -b --null', $command); - } - } - -}
\ No newline at end of file diff --git a/library/kzykhys/git/test/PHPGit/GitTest.php b/library/kzykhys/git/test/PHPGit/GitTest.php deleted file mode 100644 index c9aceeb13..000000000 --- a/library/kzykhys/git/test/PHPGit/GitTest.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -use PHPGit\Git; - -class GitTest extends PHPUnit_Framework_TestCase -{ - - public function testGetVersion() - { - $git = new Git(); - $this->assertNotEmpty($git->getVersion()); - } - - /** - * @expectedException \PHPGit\Exception\GitException - */ - public function testInvalidGitBinary() - { - $git = new Git(); - $git->setBin('/foo/bar'); - $git->getVersion(); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testBadMethodCall() - { - $git = new Git(); - $git->foo(); - } - -}
\ No newline at end of file |