Skip to content

Commit

Permalink
add langtests to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajaki authored and Sajaki committed Jan 30, 2016
1 parent 5852d26 commit eded672
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -45,6 +45,7 @@ branches:
install:
- travis_retry composer install --dev --no-interaction --prefer-source
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
- travis/prepare-langtest.sh $EXTNAME $PHPBB_BRANCH
- cd ../../phpBB3
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION
Expand All @@ -57,3 +58,4 @@ script:
- sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION; fi"
- phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php
- sh -c "if [ '$EPV' != '0' ] && [ '$TRAVIS_PHP_VERSION' = '5.3.3' ] && [ '$DB' = 'mysqli' ]; then phpBB/ext/$EXTNAME/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ] && [ '$DB' = 'mysqli' ]; then ../langtest/travis/test-lang.sh; fi"
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -18,6 +18,7 @@
},
"require-dev": {
"phpbb/epv": "dev-master"
"phpbb/translation-validator" : "1.3.*"
},
"extra": {
"display-name": "bbGuild",
Expand Down
58 changes: 58 additions & 0 deletions travis/prepare-langtest.sh
@@ -0,0 +1,58 @@
#!/bin/bash
#
# This file is part of the hookup extension for phpBB
#
# @copyright (c) gn#36
# @license GNU General Public License, version 2 (GPL-2.0)
#
#
set -e
set -x

EXTNAME=$1
BRANCH=$2

# This assumes that we are still in the ext-dir
EXTPATH=.
LANGTESTPATH=../../langtest

if [ -d $LANGTESTPATH ]; then
rm -r $LANGTESTPATH
fi
mkdir $LANGTESTPATH
cp -r $EXTPATH/language/ $LANGTESTPATH/language

# Fake a plural rule (this is extension specific, since we need to allow an array of 0-3 for the hookup constants here
lang='$lang'
for i in $(ls $EXTPATH/language/)
do
echo "<?php
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
$lang = array_merge($lang, array(
'PLURAL_RULE' => 3,
));" > $LANGTESTPATH/language/$i/common.php
done

# copy the license file to all languages to avoid that fatal error
for i in $(ls $EXTPATH/language/)
do
cp $EXTPATH/license.txt $LANGTESTPATH/language/$i/LICENSE
done

# link to vendor dir and travis dir
currentdir=`pwd`
cd $EXTPATH
absextpath=`pwd`
cd $currentdir
ln -s $absextpath/vendor/ $LANGTESTPATH/vendor
ln -s $absextpath/travis/ $LANGTESTPATH/travis

30 changes: 30 additions & 0 deletions travis/test-lang.sh
@@ -0,0 +1,30 @@
#!/bin/bash
#
# This file is part of the hookup extension for phpBB
#
# @copyright (c) gn#36
# @license GNU General Public License, version 2 (GPL-2.0)
#
#
#set -e
#set -x

echo "Running language tests"
retval=true
# we should be in phpBB3, so we need to go up one level into the langtest dir:
cd ../langtest ;

for i in $(ls language/)
do
php vendor/bin/PhpbbTranslationValidator.php validate --language-dir=language $i
if [ ! $? -eq 0 ]; then
retval=false
fi
echo "";
done;

cd ../phpBB3
if [ "$retval" = true ]; then
exit 0
fi
exit 1

0 comments on commit eded672

Please sign in to comment.