diff options
author | Vitor Mattos <vitor@php.rio> | 2021-09-15 17:33:07 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2021-09-15 18:35:32 +0300 |
commit | 4a0129607aaa132f4f5c9e89e5c5d71cc45c853e (patch) | |
tree | e5d971afe76d0a31ba1f017b54f2db49d802f666 /tests | |
parent | b5a6e59a4c5bb6769232fd06cc7ddf112e57b5e3 (diff) |
Replace deprecated function by other aproach
Fixes to remove warnings when use phpunit 9.5.6
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/php/BackgroundJob/CheckHostedSignalingServerTest.php | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php index 0627baef6..5bc392488 100644 --- a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php +++ b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php @@ -81,15 +81,15 @@ class CheckHostedSignalingServerTest extends TestCase { public function testRunWithNoChange() { $backgroundJob = $this->getBackgroundJob(); - $this->config->expects($this->at(0)) + $this->config ->method('getAppValue') - ->with('spreed', 'hosted-signaling-server-account-id', '') - ->willReturn('my-account-id'); - $this->config->expects($this->at(1)) - ->method('getAppValue') - ->with('spreed', 'hosted-signaling-server-account', '{}') - ->willReturn('{"status": "pending"}'); - $this->config->expects($this->at(2)) + ->willReturnCallback(function ($appid, $key, $default) { + switch ($key) { + case 'hosted-signaling-server-account-id': return 'my-account-id'; + case 'hosted-signaling-server-account': return '{"status": "pending"}'; + } + }); + $this->config->expects($this->once()) ->method('setAppValue') ->with('spreed', 'hosted-signaling-server-account-last-checked', null); @@ -110,26 +110,22 @@ class CheckHostedSignalingServerTest extends TestCase { ], ]; - $this->config->expects($this->at(0)) - ->method('getAppValue') - ->with('spreed', 'hosted-signaling-server-account-id', '') - ->willReturn('my-account-id'); - $this->config->expects($this->at(1)) + $this->config ->method('getAppValue') - ->with('spreed', 'hosted-signaling-server-account', '{}') - ->willReturn('{"status": "pending"}'); - $this->config->expects($this->at(2)) - ->method('setAppValue') - ->with('spreed', 'signaling_mode', 'external'); - $this->config->expects($this->at(3)) + ->willReturnCallback(function ($appid, $key, $default) { + switch ($key) { + case 'hosted-signaling-server-account-id': return 'my-account-id'; + case 'hosted-signaling-server-account': return '{"status": "pending"}'; + } + }); + $this->config->expects($this->exactly(4)) ->method('setAppValue') - ->with('spreed', 'signaling_servers', '{"servers":[{"server":"signaling-url","verify":true}],"secret":"signaling-secret"}'); - $this->config->expects($this->at(4)) - ->method('setAppValue') - ->with('spreed', 'hosted-signaling-server-account', json_encode($newStatus)); - $this->config->expects($this->at(5)) - ->method('setAppValue') - ->with('spreed', 'hosted-signaling-server-account-last-checked', null); + ->withConsecutive( + ['spreed', 'signaling_mode', 'external'], + ['spreed', 'signaling_servers', '{"servers":[{"server":"signaling-url","verify":true}],"secret":"signaling-secret"}'], + ['spreed', 'hosted-signaling-server-account', json_encode($newStatus)], + ['spreed', 'hosted-signaling-server-account-last-checked', null] + ); $group = $this->createMock(IGroup::class); $this->groupManager->expects($this->once()) |