test: replace usage of at() matcher with alternatives

The PHPUnit at() matcher, used to determine the order that methods are called
on test doubles, has been deprecated in PHPUnit 9 and has been removed in
PHPUnit 10.
Migrate usage of at() to other constructs following Drupal core examples in:
<https://www.drupal.org/node/3218874>
This commit is contained in:
Joe Nahmias
2023-06-29 23:29:04 -04:00
committed by Frédéric Guillot
parent e182856b4b
commit 6ca3bb6fec
4 changed files with 35 additions and 61 deletions

View File

@@ -88,22 +88,12 @@ class HookHelperTest extends Base
->getMock();
$this->container['template']
->expects($this->at(0))
->expects($this->any())
->method('render')
->with(
$this->equalTo('tpl1'),
$this->equalTo(array())
)
->will($this->returnValue('tpl1_content'));
$this->container['template']
->expects($this->at(1))
->method('render')
->with(
$this->equalTo('tpl2'),
$this->equalTo(array())
)
->will($this->returnValue('tpl2_content'));
->willReturnMap([
['tpl1', array(), 'tpl1_content'],
['tpl2', array(), 'tpl2_content'],
]);
$hookHelper = new HookHelper($this->container);
$hookHelper->attach('test', 'tpl1');