mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-27 04:18:55 +00:00
Compare commits
3 commits
18729adb21
...
ecd3be913f
Author | SHA1 | Date | |
---|---|---|---|
|
ecd3be913f | ||
|
65ef7f1156 | ||
|
69fa84b41b |
1 changed files with 33 additions and 25 deletions
|
@ -80,18 +80,22 @@ class phpbb_help_manager_test extends phpbb_test_case
|
||||||
->method('lang')
|
->method('lang')
|
||||||
->willReturnCallback(fn(string $arg) => strtoupper($arg));
|
->willReturnCallback(fn(string $arg) => strtoupper($arg));
|
||||||
|
|
||||||
$matcher = $this->exactly(count($questions) + 1);
|
$expected_calls = [
|
||||||
$this->template->expects($matcher)
|
['faq_block', [
|
||||||
->method('assign_block_vars')
|
|
||||||
->willReturnCallback(function ($arg1, $arg2) use ($matcher, $block_name, $switch_expected, $template_call_args) {
|
|
||||||
$callNr = $matcher->numberOfInvocations();
|
|
||||||
match (true) {
|
|
||||||
$callNr == 1 => $this->assertEquals([$arg1, $arg2], ['faq_block', [
|
|
||||||
'BLOCK_TITLE' => strtoupper($block_name),
|
'BLOCK_TITLE' => strtoupper($block_name),
|
||||||
'SWITCH_COLUMN' => $switch_expected,
|
'SWITCH_COLUMN' => $switch_expected,
|
||||||
]]),
|
]],
|
||||||
$callNr > 1 => $this->assertEquals([$arg1, $arg2], $template_call_args[$callNr - 2]),
|
...$template_call_args
|
||||||
};});
|
];
|
||||||
|
|
||||||
|
$this->template->expects($this->exactly(count($questions) + 1))
|
||||||
|
->method('assign_block_vars')
|
||||||
|
->willReturnCallback(function($blockName, $blockVars) use (&$expected_calls) {
|
||||||
|
static $call = 0;
|
||||||
|
$this->assertEquals($expected_calls[$call][0], $blockName);
|
||||||
|
$this->assertEquals($expected_calls[$call][1], $blockVars);
|
||||||
|
$call++;
|
||||||
|
});
|
||||||
|
|
||||||
$this->manager->add_block($block_name, $switch, $questions);
|
$this->manager->add_block($block_name, $switch, $questions);
|
||||||
|
|
||||||
|
@ -137,21 +141,25 @@ class phpbb_help_manager_test extends phpbb_test_case
|
||||||
->method('lang')
|
->method('lang')
|
||||||
->willReturnCallback(fn(string $arg) => strtoupper($arg));
|
->willReturnCallback(fn(string $arg) => strtoupper($arg));
|
||||||
|
|
||||||
$matcher = $this->exactly(2);
|
$expected_calls = [
|
||||||
$this->template->expects($matcher)
|
['faq_block', [
|
||||||
->method('assign_block_vars')
|
|
||||||
->willReturnCallback(function ($arg1, $arg2) use ($matcher, $block_name, $switch_expected) {
|
|
||||||
$callNr = $matcher->numberOfInvocations();
|
|
||||||
match (true) {
|
|
||||||
$callNr == 1 => $this->assertEquals([$arg1, $arg2], ['faq_block', [
|
|
||||||
'BLOCK_TITLE' => strtoupper($block_name[0]),
|
'BLOCK_TITLE' => strtoupper($block_name[0]),
|
||||||
'SWITCH_COLUMN' => $switch_expected[0],
|
'SWITCH_COLUMN' => $switch_expected[0],
|
||||||
]]),
|
]],
|
||||||
$callNr == 2 => $this->assertEquals([$arg1, $arg2], ['faq_block', [
|
['faq_block', [
|
||||||
'BLOCK_TITLE' => strtoupper($block_name[1]),
|
'BLOCK_TITLE' => strtoupper($block_name[1]),
|
||||||
'SWITCH_COLUMN' => $switch_expected[1],
|
'SWITCH_COLUMN' => $switch_expected[1],
|
||||||
]]),
|
]]
|
||||||
};});
|
];
|
||||||
|
|
||||||
|
$this->template->expects($this->exactly(count($expected_calls)))
|
||||||
|
->method('assign_block_vars')
|
||||||
|
->willReturnCallback(function($blockName, $blockVars) use (&$expected_calls) {
|
||||||
|
static $call = 0;
|
||||||
|
$this->assertEquals($expected_calls[$call][0], $blockName);
|
||||||
|
$this->assertEquals($expected_calls[$call][1], $blockVars);
|
||||||
|
$call++;
|
||||||
|
});
|
||||||
|
|
||||||
$this->manager->add_block($block_name[0], true);
|
$this->manager->add_block($block_name[0], true);
|
||||||
$this->assertTrue($this->manager->switched_column());
|
$this->assertTrue($this->manager->switched_column());
|
||||||
|
|
Loading…
Add table
Reference in a new issue