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 PHP support for TCR #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions php/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor
.phpunit.cache
9 changes: 9 additions & 0 deletions php/.tcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
config:
git:
auto-push: true
polling-period: 2s
mob-timer:
duration: 5m0s
tcr:
language: pho
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: language should be php

toolchain: phpunit
9 changes: 9 additions & 0 deletions php/.tcr/language/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
toolchains:
default: phpunit
compatible-with: [phpunit]
source-files:
directories: [src]
patterns: ['(?i)^.*\.php$']
test-files:
directories: [tests]
patterns: ['(?i)^.*\.php$']
20 changes: 20 additions & 0 deletions php/.tcr/toolchain/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
build:
- os: [darwin, linux]
arch: ["386", amd64, arm64]
command: ./vendor/bin/phpunit
arguments: [--list-tests]
- os: [windows]
arch: ["386", amd64, arm64]
command: .\vendor\bin\phpunit
arguments: [--list-tests]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From I could see, running phpunit --list-tests allows to detect syntax errors in the test files (which is good), but it does not seem to spot syntax error in source files. Do you know of any other php tool that could run syntax check on both src and test files?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried an alternative tool to run the syntax check that seems to do the job: php-parallel-lint
When running the command parallel-lint --exclude vendor . I get RC=0 if all src and test files are syntaxically correct, and RC=1 when any of these is not

test:
- os: [darwin, linux]
arch: ["386", amd64, arm64]
command: ./vendor/bin/phpunit
arguments: [tests]
- os: [windows]
arch: ["386", amd64, arm64]
command: .\vendor\bin\phpunit
arguments: [tests]
test-result-dir: .phpunit.cache

Loading