Skip to content

Commit 258b685

Browse files
committed
Phpunit: adjust method return value assertion
1 parent 11f6300 commit 258b685

File tree

7 files changed

+38
-38
lines changed

7 files changed

+38
-38
lines changed

tests/Api/CredentialsTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testAll()
2929
$api->expects($this->once())
3030
->method('get')
3131
->with($this->equalTo('/credentials/'))
32-
->will($this->returnValue($expected));
32+
->willReturn($expected);
3333

3434
$this->assertSame($expected, $api->all());
3535
}
@@ -50,7 +50,7 @@ public function testShow()
5050
$api->expects($this->once())
5151
->method('get')
5252
->with($this->equalTo('/credentials/1/'))
53-
->will($this->returnValue($expected));
53+
->willReturn($expected);
5454

5555
$this->assertSame($expected, $api->show(1));
5656
}
@@ -71,7 +71,7 @@ public function testCreate()
7171
$api->expects($this->once())
7272
->method('post')
7373
->with($this->equalTo('/credentials/'), $this->equalTo(['domain' => 'localhost', 'description' => 'My secret credential', 'type' => 'http-basic', 'username' => 'username', 'credential' => 'password']))
74-
->will($this->returnValue($expected));
74+
->willReturn($expected);
7575

7676
$this->assertSame($expected, $api->create('My secret credential', 'http-basic', 'localhost', 'username', 'password'));
7777
}
@@ -92,7 +92,7 @@ public function testEdit()
9292
$api->expects($this->once())
9393
->method('put')
9494
->with($this->equalTo('/credentials/1/'), $this->equalTo(['type' => 'http-basic', 'username' => 'username', 'credential' => 'password']))
95-
->will($this->returnValue($expected));
95+
->willReturn($expected);
9696

9797
$this->assertSame($expected, $api->edit(1, 'http-basic', 'username', 'password'));
9898
}
@@ -106,7 +106,7 @@ public function testRemove()
106106
$api->expects($this->once())
107107
->method('delete')
108108
->with($this->equalTo('/credentials/1/'))
109-
->will($this->returnValue($expected));
109+
->willReturn($expected);
110110

111111
$this->assertSame($expected, $api->remove(1));
112112
}

tests/Api/CustomersTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testAll()
2626
$api->expects($this->once())
2727
->method('get')
2828
->with($this->equalTo('/customers/'))
29-
->will($this->returnValue($expected));
29+
->willReturn($expected);
3030

3131
$this->assertSame($expected, $api->all());
3232
}
@@ -44,7 +44,7 @@ public function testShow()
4444
$api->expects($this->once())
4545
->method('get')
4646
->with($this->equalTo('/customers/1/'))
47-
->will($this->returnValue($expected));
47+
->willReturn($expected);
4848

4949
$this->assertSame($expected, $api->show(1));
5050
}
@@ -65,7 +65,7 @@ public function testCreate()
6565
$api->expects($this->once())
6666
->method('post')
6767
->with($this->equalTo('/customers/'), $this->equalTo(['name' => $name, 'accessToVersionControlSource' => false]))
68-
->will($this->returnValue($expected));
68+
->willReturn($expected);
6969

7070
$this->assertSame($expected, $api->create($name));
7171
}
@@ -86,7 +86,7 @@ public function testCreateAllParameters()
8686
$api->expects($this->once())
8787
->method('post')
8888
->with($this->equalTo('/customers/'), $this->equalTo(['name' => $name, 'accessToVersionControlSource' => true, 'urlName' => 'url-name']))
89-
->will($this->returnValue($expected));
89+
->willReturn($expected);
9090

9191
$this->assertSame($expected, $api->create($name, true, 'url-name'));
9292
}
@@ -114,7 +114,7 @@ public function tesEdit()
114114
$api->expects($this->once())
115115
->method('put')
116116
->with($this->equalTo('/customers/1/'), $this->equalTo($customer))
117-
->will($this->returnValue($expected));
117+
->willReturn($expected);
118118

119119
$this->assertSame($expected, $api->edit(1, $customer));
120120
}
@@ -128,7 +128,7 @@ public function testRemove()
128128
$api->expects($this->once())
129129
->method('delete')
130130
->with($this->equalTo('/customers/1/'))
131-
->will($this->returnValue($expected));
131+
->willReturn($expected);
132132

133133
$this->assertSame($expected, $api->remove(1));
134134
}
@@ -149,7 +149,7 @@ public function testListPackages()
149149
$api->expects($this->once())
150150
->method('get')
151151
->with($this->equalTo('/customers/1/packages/'))
152-
->will($this->returnValue($expected));
152+
->willReturn($expected);
153153

154154
$this->assertSame($expected, $api->listPackages(1));
155155
}
@@ -172,7 +172,7 @@ public function testAddOrEditPackages()
172172
$api->expects($this->once())
173173
->method('post')
174174
->with($this->equalTo('/customers/1/packages/'), $this->equalTo($packages))
175-
->will($this->returnValue($expected));
175+
->willReturn($expected);
176176

177177
$this->assertSame($expected, $api->addOrEditPackages(1, $packages));
178178
}
@@ -199,7 +199,7 @@ public function testRemovePackage()
199199
$api->expects($this->once())
200200
->method('delete')
201201
->with($this->equalTo(sprintf('/customers/1/packages/%s/', $packageName)))
202-
->will($this->returnValue($expected));
202+
->willReturn($expected);
203203

204204
$this->assertSame($expected, $api->removePackage(1, $packageName));
205205
}
@@ -222,7 +222,7 @@ public function testRegenerateToken()
222222
$api->expects($this->once())
223223
->method('post')
224224
->with($this->equalTo('/customers/1/token/regenerate'), $this->equalTo($confirmation))
225-
->will($this->returnValue($expected));
225+
->willReturn($expected);
226226

227227
$this->assertSame($expected, $api->regenerateToken(1, $confirmation));
228228
}

tests/Api/JobsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testShow()
2121
$api->expects($this->once())
2222
->method('get')
2323
->with($this->equalTo('/jobs/' . $jobId))
24-
->will($this->returnValue($expected));
24+
->willReturn($expected);
2525

2626
$this->assertSame($expected, $api->show($jobId));
2727
}

tests/Api/OrganizationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testSync()
2020
$api->expects($this->once())
2121
->method('post')
2222
->with($this->equalTo('/organization/sync'))
23-
->will($this->returnValue($expected));
23+
->willReturn($expected);
2424

2525
$this->assertSame($expected, $api->sync());
2626
}

tests/Api/PackagesTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testAll()
2525
$api->expects($this->once())
2626
->method('get')
2727
->with($this->equalTo('/packages/'))
28-
->will($this->returnValue($expected));
28+
->willReturn($expected);
2929

3030
$this->assertSame($expected, $api->all());
3131
}
@@ -48,7 +48,7 @@ public function testAllWithFilters()
4848
$api->expects($this->once())
4949
->method('get')
5050
->with($this->equalTo('/packages/'), $this->equalTo($filters))
51-
->will($this->returnValue($expected));
51+
->willReturn($expected);
5252

5353
$this->assertSame($expected, $api->all($filters));
5454
}
@@ -82,7 +82,7 @@ public function testShow()
8282
$api->expects($this->once())
8383
->method('get')
8484
->with($this->equalTo('/packages/acme-website/package/'))
85-
->will($this->returnValue($expected));
85+
->willReturn($expected);
8686

8787
$this->assertSame($expected, $api->show('acme-website/package'));
8888
}
@@ -99,7 +99,7 @@ public function testCreateVcsPackage()
9999
$api->expects($this->once())
100100
->method('post')
101101
->with($this->equalTo('/packages/'), $this->equalTo(['repoType' => 'vcs', 'repoUrl' => 'localhost', 'credentials' => null]))
102-
->will($this->returnValue($expected));
102+
->willReturn($expected);
103103

104104
$this->assertSame($expected, $api->createVcsPackage('localhost'));
105105
}
@@ -144,7 +144,7 @@ public function testEditVcsPackage()
144144
$api->expects($this->once())
145145
->method('put')
146146
->with($this->equalTo('/packages/acme-website/package/'), $this->equalTo(['repoType' => 'vcs', 'repoUrl' => 'localhost', 'credentials' => null]))
147-
->will($this->returnValue($expected));
147+
->willReturn($expected);
148148

149149
$this->assertSame($expected, $api->editVcsPackage('acme-website/package', 'localhost'));
150150
}
@@ -161,7 +161,7 @@ public function testEditCustomPackage()
161161
$api->expects($this->once())
162162
->method('put')
163163
->with($this->equalTo('/packages/acme-website/package/'), $this->equalTo(['repoType' => 'package', 'repoConfig' => '{}', 'credentials' => null]))
164-
->will($this->returnValue($expected));
164+
->willReturn($expected);
165165

166166
$this->assertSame($expected, $api->editCustomPackage('acme-website/package', '{}'));
167167
}
@@ -175,7 +175,7 @@ public function testRemove()
175175
$api->expects($this->once())
176176
->method('delete')
177177
->with($this->equalTo('/packages/acme-website/package/'))
178-
->will($this->returnValue($expected));
178+
->willReturn($expected);
179179

180180
$this->assertSame($expected, $api->remove('acme-website/package'));
181181
}
@@ -202,7 +202,7 @@ public function testListPackages()
202202
$api->expects($this->once())
203203
->method('get')
204204
->with($this->equalTo('/packages/composer/composer/customers/'))
205-
->will($this->returnValue($expected));
205+
->willReturn($expected);
206206

207207
$this->assertSame($expected, $api->listCustomers('composer/composer'));
208208
}

tests/Api/ProjectsTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testAll()
2222
$api->expects($this->once())
2323
->method('get')
2424
->with($this->equalTo('/projects/'))
25-
->will($this->returnValue($expected));
25+
->willReturn($expected);
2626

2727
$this->assertSame($expected, $api->all());
2828
}
@@ -38,7 +38,7 @@ public function testShow()
3838
$api->expects($this->once())
3939
->method('get')
4040
->with($this->equalTo('/projects/project/'))
41-
->will($this->returnValue($expected));
41+
->willReturn($expected);
4242

4343
$this->assertSame($expected, $api->show($projectName));
4444
}
@@ -52,7 +52,7 @@ public function testCreate()
5252
$api->expects($this->once())
5353
->method('post')
5454
->with($this->equalTo('/projects/'), $this->equalTo(['name' => 'ACME Websites']))
55-
->will($this->returnValue($expected));
55+
->willReturn($expected);
5656

5757
$this->assertSame($expected, $api->create('ACME Websites'));
5858
}
@@ -66,7 +66,7 @@ public function testRemove()
6666
$api->expects($this->once())
6767
->method('delete')
6868
->with($this->equalTo('/projects/project/'))
69-
->will($this->returnValue($expected));
69+
->willReturn($expected);
7070

7171
$this->assertSame($expected, $api->remove('project'));
7272
}
@@ -88,7 +88,7 @@ public function testListTeams()
8888
$api->expects($this->once())
8989
->method('get')
9090
->with($this->equalTo('/projects/project/teams/'))
91-
->will($this->returnValue($expected));
91+
->willReturn($expected);
9292

9393
$this->assertSame($expected, $api->listTeams('project'));
9494
}
@@ -112,7 +112,7 @@ public function testAddOrEditTeam()
112112
$api->expects($this->once())
113113
->method('post')
114114
->with($this->equalTo('/projects/project/teams/'), $this->equalTo($teams))
115-
->will($this->returnValue($expected));
115+
->willReturn($expected);
116116

117117
$this->assertSame($expected, $api->addOrEditTeams('project', $teams));
118118
}
@@ -126,7 +126,7 @@ public function testRemoveTeam()
126126
$api->expects($this->once())
127127
->method('delete')
128128
->with($this->equalTo('/projects/project/teams/42/'))
129-
->will($this->returnValue($expected));
129+
->willReturn($expected);
130130

131131
$this->assertSame($expected, $api->removeTeam('project', 42));
132132
}
@@ -147,7 +147,7 @@ public function testListPackages()
147147
$api->expects($this->once())
148148
->method('get')
149149
->with($this->equalTo('/projects/project/packages/'))
150-
->will($this->returnValue($expected));
150+
->willReturn($expected);
151151

152152
$this->assertSame($expected, $api->listPackages('project'));
153153
}
@@ -170,7 +170,7 @@ public function testListTokens()
170170
$api->expects($this->once())
171171
->method('get')
172172
->with($this->equalTo('/projects/project/tokens/'))
173-
->will($this->returnValue($expected));
173+
->willReturn($expected);
174174

175175
$this->assertSame($expected, $api->listTokens('project'));
176176
}
@@ -194,7 +194,7 @@ public function testCreateToken()
194194
'description' => 'Project Token',
195195
'access' => 'read',
196196
]))
197-
->will($this->returnValue($expected));
197+
->willReturn($expected);
198198

199199
$this->assertSame($expected, $api->createToken('project', [
200200
'description' => 'Project Token',
@@ -211,7 +211,7 @@ public function testRemoveToken()
211211
$api->expects($this->once())
212212
->method('delete')
213213
->with($this->equalTo('/projects/project/tokens/1/'))
214-
->will($this->returnValue($expected));
214+
->willReturn($expected);
215215

216216
$this->assertSame($expected, $api->removeToken('project', 1));
217217
}
@@ -225,7 +225,7 @@ public function testRegenerateToken()
225225
$api->expects($this->once())
226226
->method('post')
227227
->with($this->equalTo('/projects/project/tokens/1/regenerate'), $this->equalTo(['IConfirmOldTokenWillStopWorkingImmediately' => true]))
228-
->will($this->returnValue($expected));
228+
->willReturn($expected);
229229

230230
$this->assertSame($expected, $api->regenerateToken('project', 1, ['IConfirmOldTokenWillStopWorkingImmediately' => true]));
231231
}

tests/Api/TeamsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testAll()
3434
$api->expects($this->once())
3535
->method('get')
3636
->with($this->equalTo('/teams/'))
37-
->will($this->returnValue($expected));
37+
->willReturn($expected);
3838

3939
$this->assertSame($expected, $api->all());
4040
}

0 commit comments

Comments
 (0)