Skip to content

Commit 4261946

Browse files
committed
updated deprecated code in unit tests
1 parent 09bfcf3 commit 4261946

File tree

12 files changed

+99
-99
lines changed

12 files changed

+99
-99
lines changed

tests/Authentication/Adapter/ObjectRepositoryTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ public function testAuthentication(): void
110110
->expects($this->exactly(2))
111111
->method('findOneBy')
112112
->with($this->equalTo(['username' => 'a username']))
113-
->will($this->returnValue($entity));
113+
->willReturn($entity);
114114

115115
$objectManager = $this->createMock(ObjectManager::class);
116116
$objectManager->expects($this->exactly(2))
117117
->method('getRepository')
118118
->with($this->equalTo(IdentityObject::class))
119-
->will($this->returnValue($objectRepository));
119+
->willReturn($objectRepository);
120120

121121
$adapter = new ObjectRepositoryAdapter();
122122
$adapter->setOptions([
@@ -138,7 +138,7 @@ public function testAuthentication(): void
138138
$result->getIdentity(),
139139
);
140140

141-
$method->will($this->returnValue(null));
141+
$method->willReturn(null);
142142

143143
$result = $adapter->authenticate();
144144

@@ -156,7 +156,7 @@ public function testAuthenticationWithPublicProperties(): void
156156
->expects($this->exactly(2))
157157
->method('findOneBy')
158158
->with($this->equalTo(['username' => 'a username']))
159-
->will($this->returnValue($entity));
159+
->willReturn($entity);
160160

161161
$adapter = new ObjectRepositoryAdapter();
162162
$adapter->setOptions([
@@ -173,7 +173,7 @@ public function testAuthenticationWithPublicProperties(): void
173173

174174
$this->assertTrue($result->isValid());
175175

176-
$method->will($this->returnValue(null));
176+
$method->willReturn(null);
177177

178178
$result = $adapter->authenticate();
179179

@@ -189,7 +189,7 @@ public function testWillRefuseToAuthenticateWithoutGettersOrPublicMethods(): voi
189189
->expects($this->once())
190190
->method('findOneBy')
191191
->with($this->equalTo(['username' => 'a username']))
192-
->will($this->returnValue(new stdClass()));
192+
->willReturn(new stdClass());
193193

194194
$adapter = new ObjectRepositoryAdapter();
195195
$adapter->setOptions([
@@ -216,7 +216,7 @@ public function testCanValidateWithSpecialCrypt(): void
216216
->expects($this->exactly(2))
217217
->method('findOneBy')
218218
->with($this->equalTo(['username' => 'username']))
219-
->will($this->returnValue($entity));
219+
->willReturn($entity);
220220

221221
$adapter = new ObjectRepositoryAdapter();
222222
$adapter->setOptions([
@@ -249,7 +249,7 @@ public function testWillRefuseToAuthenticateWhenInvalidInstanceIsFound(): void
249249
->expects($this->once())
250250
->method('findOneBy')
251251
->with($this->equalTo(['username' => 'a username']))
252-
->will($this->returnValue(new stdClass()));
252+
->willReturn(new stdClass());
253253

254254
$adapter = new ObjectRepositoryAdapter();
255255
$adapter->setOptions([
@@ -283,7 +283,7 @@ public function testWillNotCastAuthCredentialValue(): void
283283
->expects($this->once())
284284
->method('findOneBy')
285285
->with($this->equalTo(['username' => 'a username']))
286-
->will($this->returnValue($entity));
286+
->willReturn($entity);
287287

288288
$this->assertFalse($adapter->authenticate()->isValid());
289289
}

tests/Authentication/Storage/ObjectRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public function testCanRetrieveEntityFromObjectRepositoryStorage(): void
2727
$objectRepository->expects($this->exactly(1))
2828
->method('find')
2929
->with($this->equalTo('a username'))
30-
->will($this->returnValue($entity));
30+
->willReturn($entity);
3131

3232
$metadata = $this->createMock(ClassMetadata::class);
3333
$metadata->expects($this->exactly(1))
3434
->method('getIdentifierValues')
3535
->with($this->equalTo($entity))
36-
->will($this->returnValue($entity->getUsername()));
36+
->willReturn($entity->getUsername());
3737

3838
$storage = new ObjectRepositoryStorage([
3939
'objectRepository' => $objectRepository,

tests/Form/Element/ObjectMultiCheckboxTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testGetValueOptionsDoesntCauseInfiniteLoopIfProxyReturnsEmptyArr
6363
$proxy = $this->createMock(Proxy::class);
6464
$proxy->expects($this->exactly(2))
6565
->method('getValueOptions')
66-
->will($this->returnValue($options));
66+
->willReturn($options);
6767

6868
$element->expects($this->never())
6969
->method('setValueOptions');
@@ -80,7 +80,7 @@ public function testGetValueOptionsDoesntInvokeProxyIfOptionsNotEmpty(): void
8080
$proxy = $this->createMock(Proxy::class);
8181
$proxy->expects($this->once())
8282
->method('getValueOptions')
83-
->will($this->returnValue($options));
83+
->willReturn($options);
8484

8585
$this->setProxyViaReflection($proxy);
8686

tests/Form/Element/ObjectRadioTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testGetValueOptionsDoesntCauseInfiniteLoopIfProxyReturnsEmptyArr
3737
$proxy = $this->createMock(Proxy::class);
3838
$proxy->expects($this->exactly(2))
3939
->method('getValueOptions')
40-
->will($this->returnValue($options));
40+
->willReturn($options);
4141

4242
$element->expects($this->never())
4343
->method('setValueOptions');
@@ -54,7 +54,7 @@ public function testGetValueOptionsDoesntInvokeProxyIfOptionsNotEmpty(): void
5454
$proxy = $this->createMock(Proxy::class);
5555
$proxy->expects($this->once())
5656
->method('getValueOptions')
57-
->will($this->returnValue($options));
57+
->willReturn($options);
5858

5959
$this->setProxyViaReflection($proxy);
6060

tests/Form/Element/ObjectSelectTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testGetValueOptionsDoesntCauseInfiniteLoopIfProxyReturnsEmptyArr
8181
$proxy = $this->createMock(Proxy::class);
8282
$proxy->expects($this->exactly(2))
8383
->method('getValueOptions')
84-
->will($this->returnValue($options));
84+
->willReturn($options);
8585

8686
$element->expects($this->never())
8787
->method('setValueOptions');
@@ -98,7 +98,7 @@ public function testGetValueOptionsDoesntInvokeProxyIfOptionsNotEmpty(): void
9898
$proxy = $this->createMock(Proxy::class);
9999
$proxy->expects($this->once())
100100
->method('getValueOptions')
101-
->will($this->returnValue($options));
101+
->willReturn($options);
102102

103103
$this->setProxyViaReflection($proxy);
104104

tests/Form/Element/ProxyAwareElementTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ static function () use ($objectOne, $objectTwo) {
7676
$objectRepository = $this->createMock(ObjectRepository::class);
7777
$objectRepository->expects($this->any())
7878
->method('findAll')
79-
->will($this->returnValue($result));
79+
->willReturn($result);
8080

8181
$objectManager = $this->createMock(ObjectManager::class);
8282
$objectManager->expects($this->any())
8383
->method('getClassMetadata')
8484
->with($this->equalTo($objectClass))
85-
->will($this->returnValue($metadata));
85+
->willReturn($metadata);
8686

8787
$objectManager
8888
->expects($this->any())
8989
->method('getRepository')
9090
->with($this->equalTo($objectClass))
91-
->will($this->returnValue($objectRepository));
91+
->willReturn($objectRepository);
9292

9393
if (! method_exists($this->element, 'getProxy')) {
9494
throw new RuntimeException('Element must implement getProxy().');

0 commit comments

Comments
 (0)