From c2d15e6c3bd8a29bae89d184a999ddac15fcb807 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sun, 1 May 2016 22:29:51 -0400 Subject: New plugin repo is cloned to /store/pluginrepos/REPONAME for analysis --- .../test/PHPGit/Command/CheckoutCommandTest.php | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php (limited to 'library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php') diff --git a/library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php b/library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php new file mode 100644 index 000000000..c306ea407 --- /dev/null +++ b/library/kzykhys/git/test/PHPGit/Command/CheckoutCommandTest.php @@ -0,0 +1,65 @@ +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 -- cgit v1.2.3