Skip to content

Commit

Permalink
Avoid mandatory void return type of the inherited setUp method in…
Browse files Browse the repository at this point in the history
… PHPUnit 10

This is done by renaming the inherited `setUp` method to a new `setUpTestCase` method and adding an `@before` annotation.
  • Loading branch information
Aad Mathijssen committed Aug 22, 2024
1 parent 9569a83 commit f47a90e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion tests/Constraint/ConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ class ConstraintTest extends TestCase
*/
protected $versionProvide;

protected function setUp()
/**
* @before
* @return void
*/
public function setUpTestCase()
{
$this->constraint = new Constraint('==', '1');
$this->versionProvide = new Constraint('==', 'dev-foo');
Expand Down
6 changes: 5 additions & 1 deletion tests/Constraint/MatchAllConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ class MatchAllConstraintTest extends TestCase
*/
protected $matchAllConstraint;

protected function setUp()
/**
* @before
* @return void
*/
public function setUpTestCase()
{
$this->versionProvide = new Constraint('==', '1.1');
$this->matchAllConstraint = new MatchAllConstraint();
Expand Down
6 changes: 5 additions & 1 deletion tests/Constraint/MatchNoneConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ class MatchNoneConstraintTest extends TestCase
*/
protected $matchNoneConstraint;

protected function setUp()
/**
* @before
* @return void
*/
public function setUpTestCase()
{
$this->matchNoneConstraint = new MatchNoneConstraint();
}
Expand Down
6 changes: 5 additions & 1 deletion tests/Constraint/MultiConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ class MultiConstraintTest extends TestCase
*/
protected $versionRequireEnd;

protected function setUp()
/**
* @before
* @return void
*/
public function setUpTestCase()
{
$this->versionRequireStart = new Constraint('>', '1.0');
$this->versionRequireEnd = new Constraint('<', '1.2');
Expand Down

0 comments on commit f47a90e

Please sign in to comment.