Skip to content

Commit

Permalink
minor #1038 Fix PHP Parse errors in tests (rosier)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Fix PHP Parse errors in tests

PHP 7.1 and PHP 7.2 don't support a comma after a heredoc end (T_END_HEREDOC)

Commits
-------

7e76f08 Fix PHP Parse errors in tests.
  • Loading branch information
fabpot committed Feb 9, 2025
2 parents 63912e8 + 7e76f08 commit 1aabc8e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@ jobs:
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Install PHP with extensions"
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: ${{ matrix.php }}
tools: composer:${{ matrix.composer }}

- if: matrix.php == '7.1'
name: "Lint PHP files"
run: |
find src/ -name '*.php' | xargs -n1 php -l
find tests/ -name '*.php' | xargs -n1 php -l
- name: "Validate composer.json"
run: "composer validate --strict --no-check-lock"

Expand Down Expand Up @@ -71,7 +77,3 @@ jobs:
fi
- run: vendor/bin/simple-phpunit

- if: matrix.php == '7.1'
name: "Lint PHP files"
run: find src/ -name '*.php' | xargs -n1 php -l
16 changes: 8 additions & 8 deletions tests/Configurator/AddLinesConfiguratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function testLinesAddedAfterTarget()
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
EOF,
EOF
],
]);

Expand Down Expand Up @@ -191,7 +191,7 @@ public function testSkippedIfTargetCannotBeFound()
'content' => <<<EOF
// some new line
EOF,
EOF
],
]);

Expand Down Expand Up @@ -375,7 +375,7 @@ public function getUnconfigureTests()
import * as Turbo from '@hotwired/turbo';
console.log(Turbo);
EOF,
EOF
];

yield 'found_top' => [
Expand All @@ -391,7 +391,7 @@ public function getUnconfigureTests()
import './bootstrap';
console.log(Turbo);
EOF,
EOF
];

yield 'found_bottom' => [
Expand All @@ -407,7 +407,7 @@ public function getUnconfigureTests()
import * as Turbo from '@hotwired/turbo';
import './bootstrap';
EOF,
EOF
];

yield 'not_found' => [
Expand All @@ -424,7 +424,7 @@ public function getUnconfigureTests()
import './bootstrap';
console.log(Turbo);
EOF,
EOF
];

yield 'found_twice_in_file' => [
Expand All @@ -442,7 +442,7 @@ public function getUnconfigureTests()
import './bootstrap';
console.log(Turbo);
EOF,
EOF
];
}

Expand Down Expand Up @@ -535,7 +535,7 @@ public function getUpdateTests()
console.log('bootstrap.js');
console.log('on the bottom');
EOF,
EOF
],
];

Expand Down
10 changes: 5 additions & 5 deletions tests/Update/DiffHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getRemoveFilesFromPatchTests(): iterable
-# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
-# For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
EOF,
EOF
],
];

Expand Down Expand Up @@ -169,7 +169,7 @@ public function getRemoveFilesFromPatchTests(): iterable
+ #server_version: '13'
orm:
auto_generate_proxy_classes: true
EOF,
EOF
],
];

Expand Down Expand Up @@ -220,7 +220,7 @@ public function getRemoveFilesFromPatchTests(): iterable
+ dbal:
+ # "TEST_TOKEN" is typically set by ParaTest
+ dbname_suffix: '_test%env(default::TEST_TOKEN)%'
EOF,
EOF
],
];

Expand Down Expand Up @@ -273,7 +273,7 @@ public function getRemoveFilesFromPatchTests(): iterable
+ #server_version: '13'
orm:
auto_generate_proxy_classes: true
EOF,
EOF
],
];

Expand Down Expand Up @@ -328,7 +328,7 @@ public function getRemoveFilesFromPatchTests(): iterable
- type: pool
- pool: doctrine.system_cache_pool
query_cache_driver:
EOF,
EOF
],
];
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Update/RecipePatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getGeneratePatchTests(): iterable
\ No newline at end of file
+Updated file2
\ No newline at end of file
EOF,
EOF
];

yield 'file_created_in_update_because_missing' => [
Expand All @@ -118,7 +118,7 @@ public function getGeneratePatchTests(): iterable
@@ -0,0 +1 @@
+New file
\ No newline at end of file
EOF,
EOF
];

yield 'file_created_in_update_because_null' => [
Expand All @@ -133,7 +133,7 @@ public function getGeneratePatchTests(): iterable
@@ -0,0 +1 @@
+New file
\ No newline at end of file
EOF,
EOF
];

yield 'file_deleted_in_update_because_missing' => [
Expand Down Expand Up @@ -491,7 +491,7 @@ private function getFilesForPatching(string $projectPath = ''): array
# For an SQL-HEAVY database, use: "sqlheavy:///%kernel.project_dir%/var/data.db"
DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db
###< doctrine/doctrine-bundle ###
EOF,
EOF
],

// package.json
Expand Down Expand Up @@ -536,7 +536,7 @@ private function getFilesForPatching(string $projectPath = ''): array
"@symfony/webpack-encore": "^1.7.0"
}
}
EOF,
EOF
],

// config/packages/webpack_encore.yaml
Expand All @@ -557,7 +557,7 @@ private function getFilesForPatching(string $projectPath = ''): array
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
EOF,
EOF
],

// config/packages/security.yaml
Expand Down

0 comments on commit 1aabc8e

Please sign in to comment.