Skip to content

Commit 79afb9d

Browse files
committed
add PSR formatting & syntax tests
1 parent 5f2965a commit 79afb9d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: php
2+
php:
3+
- '5.6'
4+
- nightly
5+
install: composer install
6+
script: composer test

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,11 @@
77
"keywords": ["plugin","wordpress","wp-sync-db","media"],
88
"require": {
99
"composer/installers": "~1.0.6"
10+
},
11+
"require-dev": {
12+
"phpfmt/fmt": "^19.6"
13+
},
14+
"scripts": {
15+
"test": "./test.sh"
1016
}
1117
}

test.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
set -o pipefail
4+
5+
files=(*.php class/*.php template/*.php);
6+
for file in "${files[@]}"
7+
do
8+
php -l "$file";
9+
php vendor/phpfmt/fmt/fmt.phar --psr1 --psr2 -o=- "$file" | diff -U3 \
10+
--label "$file (correct formatting)" --label "$file (original)" - "$file";
11+
done

0 commit comments

Comments
 (0)