blob: fba2fbf7638bbf3d73c0ccb03b0a66be05d7a1b8 (
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
|
<?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']);
}
}
|