Issue #3432852 by mondrake: Method returnArgument() of class PHPUnit\Framework\TestCase is deprecated in PHPUnit 10

merge-requests/7160/head
catch 2024-03-22 14:08:52 +00:00
parent 1b747d5bda
commit 82e373bff8
6 changed files with 20 additions and 20 deletions

View File

@ -140,7 +140,7 @@ class ImageStyleTest extends UnitTestCase {
->getMock();
$image_effect->expects($this->any())
->method('getDerivativeExtension')
->will($this->returnArgument(0));
->willReturnArgument(0);
$image_style = $this->getImageStyleMock($image_effect_id, $image_effect);
$this->assertEquals($image_style->buildUri('public://test.jpeg'), 'public://styles/' . $image_style->id() . '/public/test.jpeg');
@ -183,7 +183,7 @@ class ImageStyleTest extends UnitTestCase {
->getMock();
$image_effect->expects($this->any())
->method('getDerivativeExtension')
->will($this->returnArgument(0));
->willReturnArgument(0);
$image_style = $this->getImageStyleMock($image_effect_id, $image_effect, ['getPrivateKey', 'getHashSalt']);
$image_style->expects($this->any())

View File

@ -400,7 +400,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
protected function setupStubPathProcessor() {
$this->pathProcessor->expects($this->any())
->method('processInbound')
->will($this->returnArgument(0));
->willReturnArgument(0);
}
}

View File

@ -296,7 +296,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Scale');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->scale(44, NULL, FALSE);
$this->assertEquals(50, $ret['height']);
@ -309,7 +309,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Scale');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->scale(NULL, 50, FALSE);
$this->assertEquals(44, $ret['width']);
@ -323,7 +323,7 @@ class ImageTest extends UnitTestCase {
// Dimensions are the same, resize should not be called.
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->scale(88, 100, FALSE);
$this->assertEquals(88, $ret['width']);
@ -337,7 +337,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('ScaleAndCrop');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->scaleAndCrop(34, 50);
$this->assertEquals(5, $ret['x']);
@ -350,7 +350,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('ScaleAndCrop');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->scaleAndCrop(44, 40);
$this->assertEquals(5, $ret['y']);
@ -363,7 +363,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('ScaleAndCrop');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->scaleAndCrop(44, 40);
$this->assertEquals(0, $ret['x']);
@ -379,7 +379,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Crop');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
// Cropping with width only should preserve the aspect ratio.
$ret = $this->image->crop(0, 0, 44);
@ -393,7 +393,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Crop');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
// Cropping with height only should preserve the aspect ratio.
$ret = $this->image->crop(0, 0, NULL, 50);
@ -407,7 +407,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Crop');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->crop(0, 0, 44, 50);
$this->assertEquals(44, $ret['width']);
@ -420,7 +420,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Convert');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->convert('png');
$this->assertEquals('png', $ret['extension']);
@ -433,7 +433,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Resize');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
// Resize with integer for width and height.
$ret = $this->image->resize(30, 40);
@ -448,7 +448,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Resize');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
// Pass a float for width.
$ret = $this->image->resize(30.4, 40);
@ -463,7 +463,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Desaturate');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$this->image->desaturate();
}
@ -475,7 +475,7 @@ class ImageTest extends UnitTestCase {
$this->getTestImageForOperation('Rotate');
$this->toolkitOperation->expects($this->once())
->method('execute')
->will($this->returnArgument(0));
->willReturnArgument(0);
$ret = $this->image->rotate(90);
$this->assertEquals(90, $ret['degrees']);

View File

@ -78,7 +78,7 @@ class ElementInfoManagerTest extends UnitTestCase {
$this->moduleHandler->expects($this->once())
->method('alter')
->with('element_info', $this->anything())
->will($this->returnArgument(0));
->willReturnArgument(0);
$plugin = $this->createMock($plugin_class);
$plugin->expects($this->once())

View File

@ -53,7 +53,7 @@ class UnroutedUrlTest extends UnitTestCase {
$this->urlAssembler = $this->createMock('Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
$this->urlAssembler->expects($this->any())
->method('assemble')
->will($this->returnArgument(0));
->willReturnArgument(0);
$this->router = $this->createMock('Drupal\Tests\Core\Routing\TestRouterInterface');
$container = new ContainerBuilder();

View File

@ -251,7 +251,7 @@ class LinkGeneratorTest extends UnitTestCase {
$this->urlAssembler->expects($this->once())
->method('assemble')
->with('https://www.drupal.org', ['set_active_class' => TRUE, 'external' => TRUE] + $this->defaultOptions)
->will($this->returnArgument(0));
->willReturnArgument(0);
$this->moduleHandler->expects($this->once())
->method('alter')