Skip to content

Commit 4316b00

Browse files
Merge branch '4.2' into 4.3
* 4.2: Use willReturn() instead of will(returnValue()).
2 parents ffa457e + 4509621 commit 4316b00

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

Tests/MessageBusTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function testItCallsMiddleware()
4949
$firstMiddleware->expects($this->once())
5050
->method('handle')
5151
->with($envelope, $this->anything())
52-
->will($this->returnCallback(function ($envelope, $stack) {
52+
->willReturnCallback(function ($envelope, $stack) {
5353
return $stack->next()->handle($envelope, $stack);
54-
}));
54+
});
5555

5656
$secondMiddleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
5757
$secondMiddleware->expects($this->once())
@@ -78,17 +78,17 @@ public function testThatAMiddlewareCanAddSomeStampsToTheEnvelope()
7878
$firstMiddleware->expects($this->once())
7979
->method('handle')
8080
->with($envelope, $this->anything())
81-
->will($this->returnCallback(function ($envelope, $stack) {
81+
->willReturnCallback(function ($envelope, $stack) {
8282
return $stack->next()->handle($envelope->with(new AnEnvelopeStamp()), $stack);
83-
}));
83+
});
8484

8585
$secondMiddleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
8686
$secondMiddleware->expects($this->once())
8787
->method('handle')
8888
->with($envelopeWithAnotherStamp, $this->anything())
89-
->will($this->returnCallback(function ($envelope, $stack) {
89+
->willReturnCallback(function ($envelope, $stack) {
9090
return $stack->next()->handle($envelope, $stack);
91-
}));
91+
});
9292

9393
$thirdMiddleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
9494
$thirdMiddleware->expects($this->once())
@@ -118,9 +118,9 @@ public function testThatAMiddlewareCanUpdateTheMessageWhileKeepingTheEnvelopeSta
118118
$firstMiddleware->expects($this->once())
119119
->method('handle')
120120
->with($envelope, $this->anything())
121-
->will($this->returnCallback(function ($envelope, $stack) use ($expectedEnvelope) {
121+
->willReturnCallback(function ($envelope, $stack) use ($expectedEnvelope) {
122122
return $stack->next()->handle($expectedEnvelope, $stack);
123-
}));
123+
});
124124

125125
$secondMiddleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
126126
$secondMiddleware->expects($this->once())

Tests/Middleware/SendMessageMiddlewareTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testItSendsTheMessageToAssignedSender()
3737
$sendersLocator = $this->createSendersLocator([DummyMessage::class => ['my_sender']], ['my_sender' => $sender]);
3838
$middleware = new SendMessageMiddleware($sendersLocator);
3939

40-
$sender->expects($this->once())->method('send')->with($envelope->with(new SentStamp(\get_class($sender), 'my_sender')))->will($this->returnArgument(0));
40+
$sender->expects($this->once())->method('send')->with($envelope->with(new SentStamp(\get_class($sender), 'my_sender')))->willReturnArgument(0);
4141

4242
$envelope = $middleware->handle($envelope, $this->getStackMock(false));
4343

@@ -65,7 +65,7 @@ public function testItSendsTheMessageToMultipleSenders()
6565
// last SentStamp should be the "foo" alias
6666
return null !== $lastSentStamp && 'foo' === $lastSentStamp->getSenderAlias();
6767
}))
68-
->will($this->returnArgument(0));
68+
->willReturnArgument(0);
6969
$sender2->expects($this->once())
7070
->method('send')
7171
->with($this->callback(function (Envelope $envelope) {
@@ -75,7 +75,7 @@ public function testItSendsTheMessageToMultipleSenders()
7575
// last SentStamp should be the "bar" alias
7676
return null !== $lastSentStamp && 'bar' === $lastSentStamp->getSenderAlias();
7777
}))
78-
->will($this->returnArgument(0));
78+
->willReturnArgument(0);
7979

8080
$envelope = $middleware->handle($envelope, $this->getStackMock(false));
8181

@@ -102,7 +102,7 @@ public function testItSendsToOnlyOneSenderOnRedelivery()
102102
;
103103
$sender2->expects($this->once())
104104
->method('send')
105-
->will($this->returnArgument(0));
105+
->willReturnArgument(0);
106106

107107
$mockStack = $this->getStackMock(false); // false because next should not be called
108108
$envelope = $middleware->handle($envelope, $mockStack);

Tests/Middleware/TraceableMiddlewareTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function testHandle()
3434
$middleware->expects($this->once())
3535
->method('handle')
3636
->with($envelope, $this->anything())
37-
->will($this->returnCallback(function ($envelope, StackInterface $stack) {
37+
->willReturnCallback(function ($envelope, StackInterface $stack) {
3838
return $stack->next()->handle($envelope, $stack);
39-
}))
39+
})
4040
;
4141

4242
$stopwatch = $this->createMock(Stopwatch::class);

Tests/RoutableMessageBusTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testItRoutesToTheCorrectBus()
3131

3232
$container = $this->createMock(ContainerInterface::class);
3333
$container->expects($this->once())->method('has')->with('foo_bus')->willReturn(true);
34-
$container->expects($this->once())->method('get')->will($this->returnValue($bus2));
34+
$container->expects($this->once())->method('get')->willReturn($bus2);
3535

3636
$stamp = new DelayStamp(5);
3737
$bus1->expects($this->never())->method('dispatch');

Tests/Transport/Doctrine/DoctrineTransportFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public function testCreateTransportMustThrowAnExceptionIfManagerIsNotFound()
5858
$registry = $this->getMockBuilder(RegistryInterface::class)->getMock();
5959
$registry->expects($this->once())
6060
->method('getConnection')
61-
->will($this->returnCallback(function () {
61+
->willReturnCallback(function () {
6262
throw new \InvalidArgumentException();
63-
}));
63+
});
6464

6565
$factory = new DoctrineTransportFactory($registry);
6666
$factory->createTransport('doctrine://default', [], $this->createMock(SerializerInterface::class));

0 commit comments

Comments
 (0)