From 83745f63d3e2d97cd1d32cebb7049d4696d287f9 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 10 Sep 2024 16:42:27 +1200 Subject: [PATCH] DEP Use PHPUnit 11 --- composer.json | 2 +- tests/EditableSpamProtectionFieldTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 5b5c98a..8fa18e8 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "silverstripe/framework": "^6" }, "require-dev": { - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^11.3", "silverstripe/versioned": "^3", "squizlabs/php_codesniffer": "^3", "silverstripe/userforms": "^7", diff --git a/tests/EditableSpamProtectionFieldTest.php b/tests/EditableSpamProtectionFieldTest.php index 182de53..55d3a8e 100644 --- a/tests/EditableSpamProtectionFieldTest.php +++ b/tests/EditableSpamProtectionFieldTest.php @@ -43,7 +43,7 @@ class EditableSpamProtectionFieldTest extends SapphireTest ->getFormField() // mock ->expects($this->once()) ->method('validate') - ->will($this->returnValue(true)); + ->willReturn(true); $formMock ->expects($this->never()) @@ -61,7 +61,7 @@ class EditableSpamProtectionFieldTest extends SapphireTest ->getFormField() // mock ->expects($this->once()) ->method('validate') - ->will($this->returnValue(false)); + ->willReturn(false); $formMock->getValidator()->validationError('MyField', 'some field message', 'required'); @@ -82,7 +82,7 @@ class EditableSpamProtectionFieldTest extends SapphireTest ->getFormField() // mock ->expects($this->once()) ->method('validate') - ->will($this->returnValue(false)); + ->willReturn(false); // field doesn't set any validation errors here @@ -123,14 +123,14 @@ class EditableSpamProtectionFieldTest extends SapphireTest protected function getFormMock() { $formMock = $this->getMockBuilder(Form::class) - ->setMethods(['sessionMessage', 'sessionError', 'getValidator']) + ->onlyMethods(['sessionMessage', 'sessionError', 'getValidator']) ->disableOriginalConstructor() ->getMock(); $formMock ->expects($this->any()) ->method('getValidator') - ->will($this->returnValue(new RequiredFields())); + ->willReturn(new RequiredFields()); return $formMock; }