]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Run languages tests using PHPUnit test suites
authorArthurHoaro <arthur@hoa.ro>
Sun, 15 Jan 2017 15:31:53 +0000 (16:31 +0100)
committerArthurHoaro <arthur@hoa.ro>
Mon, 6 Mar 2017 20:11:18 +0000 (21:11 +0100)
.travis.yml
Makefile
composer.json
phpunit.xml

index 03071a4734535485b8f9cc0f0106a3f8668de34c..2a5ff5e3cafb1546ee6a815091da4a5035b3f35a 100644 (file)
@@ -1,5 +1,11 @@
 sudo: false
 language: php
+addons:
+  apt:
+    packages:
+      - locales
+      - language-pack-de
+      - language-pack-fr
 cache:
   directories:
     - $HOME/.composer/cache
index f3065b77ed2658856018372444844dc00e4575da..1d8a73a2e6f8b27a05e36d29225db1db567c1e22 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -124,8 +124,20 @@ test:
        @echo "-------"
        @echo "PHPUNIT"
        @echo "-------"
-       @mkdir -p sandbox
-       @$(BIN)/phpunit tests
+       @mkdir -p sandbox coverage
+       @$(BIN)/phpunit --coverage-php coverage/main.cov --testsuite unit-tests
+
+locale_test_%:
+       @UT_LOCALE=$*.utf8 \
+               $(BIN)/phpunit \
+               --coverage-php coverage/$(firstword $(subst _, ,$*)).cov \
+               --bootstrap tests/languages/bootstrap.php \
+               --testsuite language-$(firstword $(subst _, ,$*))
+
+all_tests: test locale_test_de_DE locale_test_en_US locale_test_fr_FR
+       @$(BIN)/phpcov merge --html coverage coverage
+       @# --text doesn't work with phpunit 4.* (v5 requires PHP 5.6)
+       @#$(BIN)/phpcov merge --text coverage/txt coverage
 
 ##
 # Custom release archive generation
index b82aceefe43402f64e38120a934e5a456d3469d1..70b87bb95b33cba9e4e8a1de71eb2dd9f9f5ed7b 100644 (file)
@@ -20,7 +20,8 @@
         "phpmd/phpmd" : "@stable",
         "phpunit/phpunit": "4.8.*",
         "sebastian/phpcpd": "*",
-        "squizlabs/php_codesniffer": "2.*"
+        "squizlabs/php_codesniffer": "2.*",
+        "phpunit/phpcov": "*"
     },
     "autoload": {
         "psr-4": {
index d6e01c35795b3837d97c2aa4366e4d383509f569..8b66e6c5b3ce0d0ccd351766f6678c353eef3a86 100644 (file)
@@ -3,13 +3,25 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
     colors="true">
+  <testsuites>
+    <testsuite name="unit-tests">
+      <directory>tests</directory>
+      <exclude>tests/languages</exclude>
+    </testsuite>
+    <testsuite name="language-de">
+      <directory>tests/languages/de</directory>
+    </testsuite>
+    <testsuite name="language-en">
+      <directory>tests/languages/en</directory>
+    </testsuite>
+    <testsuite name="language-fr">
+      <directory>tests/languages/fr</directory>
+    </testsuite>
+  </testsuites>
+
   <filter>
     <whitelist addUncoveredFilesFromWhitelist="true">
       <directory suffix=".php">application</directory>
     </whitelist>
   </filter>
-  <logging>
-    <log type="coverage-html" target="coverage" lowUpperBound="30" highLowerBound="80"/>
-    <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
-  </logging>
 </phpunit>