diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-01-15 16:31:53 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-03-06 21:11:18 +0100 |
commit | 6c7d68645409cfad3858b5f252f5a49b148e3b53 (patch) | |
tree | fd81f0a21240ad42ee0c00a4b41d11f7149ef33e | |
parent | 52b503105d389d1796698114573ff618b2ad34a2 (diff) | |
download | Shaarli-6c7d68645409cfad3858b5f252f5a49b148e3b53.tar.gz Shaarli-6c7d68645409cfad3858b5f252f5a49b148e3b53.tar.zst Shaarli-6c7d68645409cfad3858b5f252f5a49b148e3b53.zip |
Run languages tests using PHPUnit test suites
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | composer.json | 3 | ||||
-rw-r--r-- | phpunit.xml | 20 |
4 files changed, 38 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index 03071a47..2a5ff5e3 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -1,5 +1,11 @@ | |||
1 | sudo: false | 1 | sudo: false |
2 | language: php | 2 | language: php |
3 | addons: | ||
4 | apt: | ||
5 | packages: | ||
6 | - locales | ||
7 | - language-pack-de | ||
8 | - language-pack-fr | ||
3 | cache: | 9 | cache: |
4 | directories: | 10 | directories: |
5 | - $HOME/.composer/cache | 11 | - $HOME/.composer/cache |
@@ -124,8 +124,20 @@ test: | |||
124 | @echo "-------" | 124 | @echo "-------" |
125 | @echo "PHPUNIT" | 125 | @echo "PHPUNIT" |
126 | @echo "-------" | 126 | @echo "-------" |
127 | @mkdir -p sandbox | 127 | @mkdir -p sandbox coverage |
128 | @$(BIN)/phpunit tests | 128 | @$(BIN)/phpunit --coverage-php coverage/main.cov --testsuite unit-tests |
129 | |||
130 | locale_test_%: | ||
131 | @UT_LOCALE=$*.utf8 \ | ||
132 | $(BIN)/phpunit \ | ||
133 | --coverage-php coverage/$(firstword $(subst _, ,$*)).cov \ | ||
134 | --bootstrap tests/languages/bootstrap.php \ | ||
135 | --testsuite language-$(firstword $(subst _, ,$*)) | ||
136 | |||
137 | all_tests: test locale_test_de_DE locale_test_en_US locale_test_fr_FR | ||
138 | @$(BIN)/phpcov merge --html coverage coverage | ||
139 | @# --text doesn't work with phpunit 4.* (v5 requires PHP 5.6) | ||
140 | @#$(BIN)/phpcov merge --text coverage/txt coverage | ||
129 | 141 | ||
130 | ## | 142 | ## |
131 | # Custom release archive generation | 143 | # Custom release archive generation |
diff --git a/composer.json b/composer.json index b82aceef..70b87bb9 100644 --- a/composer.json +++ b/composer.json | |||
@@ -20,7 +20,8 @@ | |||
20 | "phpmd/phpmd" : "@stable", | 20 | "phpmd/phpmd" : "@stable", |
21 | "phpunit/phpunit": "4.8.*", | 21 | "phpunit/phpunit": "4.8.*", |
22 | "sebastian/phpcpd": "*", | 22 | "sebastian/phpcpd": "*", |
23 | "squizlabs/php_codesniffer": "2.*" | 23 | "squizlabs/php_codesniffer": "2.*", |
24 | "phpunit/phpcov": "*" | ||
24 | }, | 25 | }, |
25 | "autoload": { | 26 | "autoload": { |
26 | "psr-4": { | 27 | "psr-4": { |
diff --git a/phpunit.xml b/phpunit.xml index d6e01c35..8b66e6c5 100644 --- a/phpunit.xml +++ b/phpunit.xml | |||
@@ -3,13 +3,25 @@ | |||
3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
4 | xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd" | 4 | xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd" |
5 | colors="true"> | 5 | colors="true"> |
6 | <testsuites> | ||
7 | <testsuite name="unit-tests"> | ||
8 | <directory>tests</directory> | ||
9 | <exclude>tests/languages</exclude> | ||
10 | </testsuite> | ||
11 | <testsuite name="language-de"> | ||
12 | <directory>tests/languages/de</directory> | ||
13 | </testsuite> | ||
14 | <testsuite name="language-en"> | ||
15 | <directory>tests/languages/en</directory> | ||
16 | </testsuite> | ||
17 | <testsuite name="language-fr"> | ||
18 | <directory>tests/languages/fr</directory> | ||
19 | </testsuite> | ||
20 | </testsuites> | ||
21 | |||
6 | <filter> | 22 | <filter> |
7 | <whitelist addUncoveredFilesFromWhitelist="true"> | 23 | <whitelist addUncoveredFilesFromWhitelist="true"> |
8 | <directory suffix=".php">application</directory> | 24 | <directory suffix=".php">application</directory> |
9 | </whitelist> | 25 | </whitelist> |
10 | </filter> | 26 | </filter> |
11 | <logging> | ||
12 | <log type="coverage-html" target="coverage" lowUpperBound="30" highLowerBound="80"/> | ||
13 | <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> | ||
14 | </logging> | ||
15 | </phpunit> | 27 | </phpunit> |