Skip to content

Commit 599c1cd

Browse files
committed
Refactor withConsecutive()
1 parent 27c1cc5 commit 599c1cd

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

ext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ class ext extends \phpbb\extension\base
3131
*/
3232
public function is_enableable()
3333
{
34-
return phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '>=') && PHP_VERSION_ID >= 80100;
34+
return PHP_VERSION_ID >= 80100 && phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '>=');
3535
}
3636
}

tests/acp/acp_module_test.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,16 @@ public function test_main_module()
104104
->disableOriginalConstructor()
105105
->getMock();
106106

107+
$services = ['language', 'phpbb.topicprefixes.admin_controller'];
108+
$returns = [$language, $admin_controller];
109+
$callCount = 0;
107110
$phpbb_container
108111
->expects(self::exactly(2))
109112
->method('get')
110-
->withConsecutive(
111-
['language'], ['phpbb.topicprefixes.admin_controller']
112-
)
113-
->willReturnOnConsecutiveCalls(
114-
$language, $admin_controller
115-
);
113+
->willReturnCallback(function($service) use ($services, $returns, &$callCount) {
114+
$this->assertEquals($services[$callCount], $service);
115+
return $returns[$callCount++];
116+
});
116117

117118
$admin_controller
118119
->expects(self::once())

0 commit comments

Comments
 (0)