aboutsummaryrefslogtreecommitdiffstats
path: root/library/kzykhys/git/test/PHPGit/Command/Remote/SetUrlCommandTest.php
blob: b70b67d400ee18e2c5cf8539e12f04d256339e0e (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
<?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']);
    }

}