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:
committed by
Frédéric Guillot
parent
e182856b4b
commit
6ca3bb6fec
@@ -51,20 +51,13 @@ class UserNotificationTest extends Base
|
||||
));
|
||||
|
||||
$this->container['userNotificationTypeModel']
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(3))
|
||||
->method('getSelectedTypes')
|
||||
->will($this->returnValue(array('email')));
|
||||
|
||||
$this->container['userNotificationTypeModel']
|
||||
->expects($this->at(1))
|
||||
->method('getSelectedTypes')
|
||||
->will($this->returnValue(array('email')));
|
||||
|
||||
$this->container['userNotificationTypeModel']
|
||||
->expects($this->at(2))
|
||||
->method('getSelectedTypes')
|
||||
->with($this->equalTo(1))
|
||||
->will($this->returnValue(array('email', 'web')));
|
||||
->willReturnOnConsecutiveCalls(
|
||||
array('email'),
|
||||
array('email'),
|
||||
array('email','web'),
|
||||
);
|
||||
|
||||
$settings = $n->readSettings(1);
|
||||
$this->assertNotEmpty($settings);
|
||||
@@ -209,21 +202,18 @@ class UserNotificationTest extends Base
|
||||
->method('notifyUser');
|
||||
|
||||
$this->container['userNotificationTypeModel']
|
||||
->expects($this->at(0))
|
||||
->expects($this->once())
|
||||
->method('getSelectedTypes')
|
||||
->will($this->returnValue(array('email', 'web')));
|
||||
|
||||
$this->container['userNotificationTypeModel']
|
||||
->expects($this->at(1))
|
||||
->expects($this->exactly(2))
|
||||
->method('getType')
|
||||
->with($this->equalTo('email'))
|
||||
->will($this->returnValue($notifier));
|
||||
|
||||
$this->container['userNotificationTypeModel']
|
||||
->expects($this->at(2))
|
||||
->method('getType')
|
||||
->with($this->equalTo('web'))
|
||||
->will($this->returnValue($notifier));
|
||||
->withConsecutive(
|
||||
['email'],
|
||||
['web'],
|
||||
)
|
||||
->willReturn($notifier);
|
||||
|
||||
$userNotificationModel->sendNotifications(TaskModel::EVENT_CREATE, array('task' => $taskFinderModel->getDetails(1)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user