aboutsummaryrefslogtreecommitdiffstats
path: root/library/kzykhys/git/test/PHPGit/Command/Remote/SetHeadCommandTest.php
blob: 679c2976fad873862f4cfd1dc8082334557fee90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?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);
    }

}