mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-24 04:15:16 +00:00
56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
|
<?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);
|
||
|
}
|
||
|
|
||
|
}
|