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
@@ -175,14 +175,12 @@ class TaskFileModelTest extends Base
|
||||
->method('generateThumbnailFromFile');
|
||||
|
||||
$this->container['objectStorage']
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('moveUploadedFile')
|
||||
->with($this->equalTo('/tmp/phpYzdqkD'), $this->anything());
|
||||
|
||||
$this->container['objectStorage']
|
||||
->expects($this->at(1))
|
||||
->method('moveUploadedFile')
|
||||
->with($this->equalTo('/tmp/phpeEwEWG'), $this->anything());
|
||||
->withConsecutive(
|
||||
['/tmp/phpYzdqkD'],
|
||||
['/tmp/phpeEwEWG'],
|
||||
);
|
||||
|
||||
$this->assertTrue($fileModel->uploadFiles(1, $files));
|
||||
|
||||
@@ -259,7 +257,7 @@ class TaskFileModelTest extends Base
|
||||
);
|
||||
|
||||
$this->container['objectStorage']
|
||||
->expects($this->at(0))
|
||||
->expects($this->once())
|
||||
->method('moveUploadedFile')
|
||||
->with($this->equalTo('/tmp/phpYzdqkD'), $this->anything())
|
||||
->will($this->throwException(new \Kanboard\Core\ObjectStorage\ObjectStorageException('test')));
|
||||
@@ -411,14 +409,12 @@ class TaskFileModelTest extends Base
|
||||
$this->assertEquals(1, $fileModel->create(1, 'image.gif', 'tmp/image.gif', 10));
|
||||
|
||||
$this->container['objectStorage']
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('remove')
|
||||
->with('tmp/image.gif');
|
||||
|
||||
$this->container['objectStorage']
|
||||
->expects($this->at(1))
|
||||
->method('remove')
|
||||
->with('thumbnails'.DIRECTORY_SEPARATOR.'tmp/image.gif');
|
||||
->withConsecutive(
|
||||
['tmp/image.gif'],
|
||||
['thumbnails'.DIRECTORY_SEPARATOR.'tmp/image.gif'],
|
||||
);
|
||||
|
||||
$this->assertTrue($fileModel->remove(1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user