Describe the bug
The ComposerTest class fails when generating composer.json settings. PHPUnit reports these errors:
Failed asserting that two strings are identical.
#Warning: Strings contain different line endings!
There are at least three possible causes:
- Schema Mismatch: The "actual" output includes an
authors block missing from the "expected" resource file.
- For the file line endings, there is a possible mismatch between Unix (\n) and Windows (\r\n) endings.
- The expected value conains Unix path separators which causes the tests to fail in a Windows environment. The path separator should be normalized to prevent this.
PHPUnit diffs
-'{
- "name": "wsdltophp/bing",
- "description": "Package generated from C:\CS\Web Development\PHP\WsdlToPHP\PackageGenerator\PackageGenerator\tests/resources/bingsearch.wsdl using wsdltophp/packagegenerator",
- "require": {
- "php": ">=7.4",
- "ext-dom": "*",
- "ext-mbstring": "*",
- "ext-soap": "*",
- "wsdltophp/packagebase": "~5.0",
- "wsdltophp/wssecurity": "dev-master"
- },
- "autoload": {
- "psr-4": {
- "": "./src/"
- }
- },
- "require-dev": {
- "friendsofphp/php-cs-fixer": "^3.0",
- "phpstan/phpstan": "^2",
- "phpunit/phpunit": "^9",
- "rector/rector": "^2"
- },
- "config": {
- "disable-tls": true,
- "sort-packages": true
- }
PHPUnit - example output for "actual" value:
+'{
+ "name": "wsdltophp/bing",
+ "description": "Package generated from C:\\CS\\Web Development\\PHP\\WsdlToPHP\\PackageGenerator\\PackageGenerator\\tests/resources/bingsearch.wsdl using wsdltophp/packagegenerator",
+ "require": {
+ "php": ">=7.4",
+ "ext-dom": "*",
+ "ext-mbstring": "*",
+ "ext-soap": "*",
+ "wsdltophp/packagebase": "~5.0",
+ "wsdltophp/wssecurity": "dev-master"
+ },
+ "authors": [
+ {
+ "name": "author_name",
+ "email": "author@email.com"
+ }
+ ],
+ "autoload": {
+ "psr-4": {
+ "": "./src\\"
+ }
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.0",
+ "phpstan/phpstan": "^2",
+ "phpunit/phpunit": "^9",
+ "rector/rector": "^2"
+ },
+ "config": {
+ "disable-tls": true,
+ "sort-packages": true
+ }
To Reproduce
Run the tests:
composer test
vendor/bin/phpunit --filter=ComposerTest
Expected behavior
Tests should pass regardless of the development platform, and the expected resource files should match the generated schema.
Additional context
The "expected" value comes from test files in the following location: src/tests/resources/generated.
Describe the bug
The
ComposerTestclass fails when generatingcomposer.jsonsettings. PHPUnit reports these errors:Failed asserting that two strings are identical.#Warning: Strings contain different line endings!There are at least three possible causes:
authorsblock missing from the "expected" resource file.PHPUnit diffs
PHPUnit - example output for "actual" value:
To Reproduce
Run the tests:
composer testvendor/bin/phpunit --filter=ComposerTestExpected behavior
Tests should pass regardless of the development platform, and the expected resource files should match the generated schema.
Additional context
The "expected" value comes from test files in the following location:
src/tests/resources/generated.