Repository navigation
test: Initial coverage of PHPUnit assertions *WITHOUT* this extension - #2
Conversation
40cd713 to
91029d7
Compare
| Then it should fail with the following results: | ||
| """ | ||
| # FAILED Scenario: Compare mismatched array | ||
| Then an array {"value": "foo"} should equal {"value": "bar"}: Should get the right value | ||
| Failed asserting that two arrays are equal. (PHPUnit\Framework\ExpectationFailedException) | ||
|
|
||
| # PASSED Scenario: Compare matching array | ||
| (no failures) | ||
|
|
||
| # FAILED Scenario: Compare mismatched ints | ||
| Then an integer 1 should equal 2: check the ints | ||
| Failed asserting that 1 is identical to 2. (PHPUnit\Framework\ExpectationFailedException) | ||
|
|
||
| # PASSED Scenario: Compare matching ints | ||
| (no failures) | ||
| """ |
There was a problem hiding this comment.
The string content here is a custom stringification of Behat's JSON report.
From 4.0 onwards, we've said that Behat's pretty and progress format outputs are intended to be human-readable and may change in minor releases - only the machine-readable formats are guaranteed stable.
Therefore we should not assert on the actual Behat command output, as that may change. Summarising the JSON gives a good balance between build stability and feature readability.
This does mean we're assuming that our stringer will be used by all formatters - but I think that's OK based on the contracts/interfaces Behat provides for exception stringers.
| return (new Config()) | ||
| ->withProfile( | ||
| (new Profile('default')) | ||
| ->withExtension(new Extension(OverrideBuiltinPhpunitStringerExtension::class)), |
There was a problem hiding this comment.
This extension will be removed after the next Behat 4.0 release
| "phpstan/phpstan": "2.1.46", | ||
| "rector/rector": "2.3.9" | ||
| "rector/rector": "2.3.9", | ||
| "sebastian/diff": ">=3.0.6 <10", |
There was a problem hiding this comment.
It needs to be a very wide sebastian/diff supported range, to work with the range of PHPUnit versions that will be installed in the next PR.
| "php": ">=8.2 <8.6", | ||
| "behat/behat": "^4.0@alpha" | ||
| "behat/behat": "^4.0@alpha", | ||
| "phpunit/phpunit": "^8.5" |
There was a problem hiding this comment.
The next PR widens the supported PHPUnit range - this one just gets it working.
afba5bb to
7567826
Compare
Before we can prove that this extension formats phpunit assertions as expected, we need to prove that they *aren't* formatted specially by Behat core. At the moment, this means loading a hacky extension in the tests to remove the default Behat PHPUnit stringer. Once we have a 4.0 release without that, we can remove the hacky extension. It's probably still worth keeping the feature coverage so that we can see the difference this extension makes.
The older versions of symfony/filesystem we provide don't include the `->readFile` method. Use our own.
7567826 to
7fd3698
Compare
carlos-granados
left a comment
There was a problem hiding this comment.
Having to use an override extension is a bit ugly but can't think of a better option, thanks @acoulton
|
Agreed - I'll remove it as soon as we get 4.0 released. |
Before we can prove that this extension formats phpunit assertions as expected, we need to prove that they aren't formatted specially by Behat core.
At the moment, this means loading a hacky extension in the tests to remove the default Behat PHPUnit stringer. Once we have a 4.0 release without that, we can remove the hacky extension. It's probably still worth keeping the feature coverage so that we can see the difference this extension makes.