/
RemoteTest.php
104 lines (83 loc) · 2.1 KB
/
RemoteTest.php
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
namespace Satooshi\Bundle\CoverallsV1Bundle\Entity\Git;
/**
* @covers \Satooshi\Bundle\CoverallsV1Bundle\Entity\Git\Remote
* @covers \Satooshi\Bundle\CoverallsV1Bundle\Entity\Coveralls
*
* @author Kitamura Satoshi <with.no.parachute@gmail.com>
*/
class RemoteTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
$this->object = new Remote();
}
// getName()
/**
* @test
*/
public function shouldNotHaveRemoteNameOnConstruction()
{
$this->assertNull($this->object->getName());
}
// getUrl()
/**
* @test
*/
public function shouldNotHaveUrlOnConstruction()
{
$this->assertNull($this->object->getUrl());
}
// setName()
/**
* @test
*/
public function shouldSetRemoteName()
{
$expected = 'remote_name';
$obj = $this->object->setName($expected);
$this->assertSame($expected, $this->object->getName());
$this->assertSame($obj, $this->object);
}
// setUrl()
/**
* @test
*/
public function shouldSetRemoteUrl()
{
$expected = 'git@github.com:php-coveralls/php-coveralls.git';
$obj = $this->object->setUrl($expected);
$this->assertSame($expected, $this->object->getUrl());
$this->assertSame($obj, $this->object);
}
// toArray()
/**
* @test
*/
public function shouldConvertToArray()
{
$expected = array(
'name' => null,
'url' => null,
);
$this->assertSame($expected, $this->object->toArray());
$this->assertSame(json_encode($expected), (string) $this->object);
}
/**
* @test
*/
public function shouldConvertToFilledArray()
{
$name = 'name';
$url = 'url';
$this->object
->setName($name)
->setUrl($url);
$expected = array(
'name' => $name,
'url' => $url,
);
$this->assertSame($expected, $this->object->toArray());
$this->assertSame(json_encode($expected), (string) $this->object);
}
}