Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for phpunit 11 #57

Merged
merged 7 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"php": ">=7.4",
"doctrine/inflector": "^2.0",
"phpdocumentor/type-resolver": "^1.7",
"phpunit/phpunit": "^9.0 || ^10.0"
"phpunit/phpunit": "^9.0 || ^10.0 || ^11.0"
},
"require-dev": {
"phpmd/phpmd": "@stable",
Expand Down
18 changes: 10 additions & 8 deletions src/Constraint/AccessorPairConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use ReflectionClass;
use ReflectionMethod;
use ReflectionParameter;
use SebastianBergmann\Exporter\Exporter;

class AccessorPairConstraint extends Constraint
{
Expand Down Expand Up @@ -131,7 +132,6 @@ protected function testPropertyDefaults(array $accessorPairs): void

/**
* Test all accessorPairs, by passing test values to the setter and expect the exact same value back from the getter.
*
* @throws Exception
*/
protected function testAccessorPair(AccessorPair $accessorPair): void
Expand All @@ -154,7 +154,6 @@ protected function testAccessorPair(AccessorPair $accessorPair): void
/**
* The setter's parameter has a default value
* Call the setter without provider a parameter. Then call the getter and expect the default value return.
*
* @throws Exception
*/
protected function testOptionalParameter(AccessorPair $accessorPair, ReflectionParameter $parameter): void
Expand All @@ -173,10 +172,11 @@ protected function testOptionalParameter(AccessorPair $accessorPair, ReflectionP
$storedValue = $accessorPair->getGetMethod()->invoke($instance);

if ($storedValue !== $expectedReturn) {
$exporter = new Exporter();
$this->fail(
$accessorPair->getClass()->getNamespaceName(),
"Stored value (" . $this->exporter()->export($storedValue) . ") does not match " .
"default value (" . $this->exporter()->export($expectedReturn) . ")"
"Stored value (" . $exporter->export($storedValue) . ") does not match " .
"default value (" . $exporter->export($expectedReturn) . ")"
);
}
}
Expand Down Expand Up @@ -218,10 +218,11 @@ protected function testParameter(ReflectionParameter $parameter, AccessorPair $a
}

if ($storedValue !== $expectedReturn) {
$exporter = new Exporter();
$this->fail(
$accessorPair->getClass()->getNamespaceName(),
"Stored value (" . $this->exporter()->export($storedValue) . ") does not match " .
"given value (" . $this->exporter()->export($expectedReturn) . ")"
"Stored value (" . $exporter->export($storedValue) . ") does not match " .
"given value (" . $exporter->export($expectedReturn) . ")"
);
}
}
Expand Down Expand Up @@ -263,10 +264,11 @@ protected function testConstructorPair(ConstructorPair $constructorPair): void
}

if ($storedValue !== $expectedReturn) {
$exporter = new Exporter();
$this->fail(
$constructorPair->getClass()->getNamespaceName(),
"Stored value (" . $this->exporter()->export($storedValue) . ") does not match " .
"given value (" . $this->exporter()->export($expectedReturn) . ")"
"Stored value (" . $exporter->export($storedValue) . ") does not match " .
"given value (" . $exporter->export($expectedReturn) . ")"
);
}
}
Expand Down
Loading