Skip to content

Commit ab6fb0f

Browse files
committed
Run tests in phpBB 3.3
1 parent 15b11ca commit ab6fb0f

22 files changed

+50
-59
lines changed

.travis.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
language: php
2-
dist: trusty
2+
dist: xenial
33

44
matrix:
55
include:
6-
- php: 5.5
6+
- php: 7.1
77
env: DB=none;NOTESTS=1
8-
- php: 5.4
9-
env: DB=mysqli #myisam
10-
- php: 5.4
11-
env: DB=mysql
12-
- php: 5.4
8+
- php: 7.1
139
env: DB=mariadb
14-
- php: 5.4
10+
- php: 7.1
1511
env: DB=postgres
16-
- php: 5.4
12+
- php: 7.1
1713
env: DB=sqlite3
18-
- php: 5.5
19-
env: DB=mysqli
20-
- php: 5.6
21-
env: DB=mysqli
22-
- php: 7.0
23-
env: DB=mysqli
2414
- php: 7.1
25-
env: DB=mysqli
15+
env: DB=mysqli # MyISAM
2616
- php: 7.2
2717
env: DB=mysqli
18+
- php: 7.3
19+
env: DB=mysqli
20+
- php: 7.4snapshot
21+
env: DB=mysqli
2822
- php: nightly
2923
env: DB=mysqli
3024
allow_failures:
@@ -39,7 +33,7 @@ env:
3933
- IMAGE_ICC="0" # Should we run icc profile sniffer on your images?
4034
- EPV="1" # Should we run EPV (Extension Pre Validator) on your code?
4135
- COVERAGE="1" # Should we send code coverage?
42-
- PHPBB_BRANCH="3.2.x"
36+
- PHPBB_BRANCH="3.3.x"
4337

4438
branches:
4539
only:
@@ -49,8 +43,12 @@ branches:
4943
- /^release-.*$/
5044
- /^\d+(\.\d+)?\.x$/
5145

46+
services:
47+
- postgresql
48+
- mysql
49+
5250
install:
53-
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
51+
- travis/prepare-phpbb.sh $PHPBB_BRANCH
5452
- cd ../../phpBB3
5553
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
5654
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS

phpunit.xml.dist

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
verbose="true"
1312
bootstrap="../../../../tests/bootstrap.php"
1413
>
@@ -18,14 +17,11 @@
1817
<exclude>./tests/functional</exclude>
1918
</testsuite>
2019
<testsuite name="Extension Functional Tests">
21-
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">./tests/functional/</directory>
20+
<directory suffix="_test.php">./tests/functional/</directory>
2221
</testsuite>
2322
</testsuites>
2423

2524
<filter>
26-
<blacklist>
27-
<directory>./tests/</directory>
28-
</blacklist>
2925
<whitelist processUncoveredFilesFromWhitelist="true">
3026
<directory suffix=".php">./</directory>
3127
<exclude>

tests/ad/ad_base.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getDataSet()
4646
/**
4747
* {@inheritDoc}
4848
*/
49-
public function setUp()
49+
public function setUp(): void
5050
{
5151
parent::setUp();
5252

tests/banner/create_storage_dir_test.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public function test_create_storage_dir($dir_exists, $success)
5151
{
5252
$mkdir->willThrowException(new \phpbb\filesystem\exception\filesystem_exception('CANNOT_CREATE_DIRECTORY'));
5353

54-
$this->setExpectedException('\phpbb\filesystem\exception\filesystem_exception', 'CANNOT_CREATE_DIRECTORY');
54+
$this->expectException('\phpbb\filesystem\exception\filesystem_exception');
55+
$this->expectExceptionMessage('CANNOT_CREATE_DIRECTORY');
5556
}
5657
}
5758

tests/banner/upload_test.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public function test_upload($file_move_success)
7070
->method('set_error')
7171
->with('FILE_MOVE_UNSUCCESSFUL');
7272

73-
$this->setExpectedException('\phpbb\exception\runtime_exception', 'FILE_MOVE_UNSUCCESSFUL');
73+
$this->expectException('\phpbb\exception\runtime_exception');
74+
$this->expectExceptionMessage('FILE_MOVE_UNSUCCESSFUL');
7475

7576
$manager->upload();
7677
}

tests/controller/admin_controller_test.php

+6-9
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getDataSet()
7878
/**
7979
* {@inheritDoc}
8080
*/
81-
public function setUp()
81+
public function setUp(): void
8282
{
8383
parent::setUp();
8484

@@ -1045,14 +1045,12 @@ public function test_action_delete($ad_id, $ad_owner, $error, $confirm)
10451045
->method('get_all_ads')
10461046
->willReturn(array());
10471047
}
1048+
else if ($error)
1049+
{
1050+
$this->setExpectedTriggerError(E_USER_WARNING, 'ACP_AD_DELETE_ERRORED');
1051+
}
10481052
else
10491053
{
1050-
if ($error)
1051-
{
1052-
$this->setExpectedTriggerError(E_USER_WARNING, 'ACP_AD_DELETE_ERRORED');
1053-
}
1054-
else
1055-
{
10561054
$this->manager->expects($this->once())
10571055
->method('get_ad')
10581056
->with($ad_id)
@@ -1065,8 +1063,7 @@ public function test_action_delete($ad_id, $ad_owner, $error, $confirm)
10651063
->with($ad_owner)
10661064
->willReturn(array());
10671065

1068-
$this->setExpectedTriggerError(E_USER_NOTICE, 'ACP_AD_DELETE_SUCCESS');
1069-
}
1066+
$this->setExpectedTriggerError(E_USER_NOTICE, 'ACP_AD_DELETE_SUCCESS');
10701067
}
10711068

10721069
$this->request->expects($this->at(0))

tests/controller/admin_input_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getDataSet()
4949
/**
5050
* {@inheritDoc}
5151
*/
52-
public function setUp()
52+
public function setUp(): void
5353
{
5454
parent::setUp();
5555

tests/controller/helper_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getDataSet()
6161
/**
6262
* {@inheritDoc}
6363
*/
64-
public function setUp()
64+
public function setUp(): void
6565
{
6666
parent::setUp();
6767

tests/controller/increment_controller_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getDataSet()
3737
/**
3838
* {@inheritDoc}
3939
*/
40-
public function setUp()
40+
public function setUp(): void
4141
{
4242
parent::setUp();
4343

tests/controller/ucp_controller_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getDataSet()
5252
/**
5353
* {@inheritDoc}
5454
*/
55-
public function setUp()
55+
public function setUp(): void
5656
{
5757
parent::setUp();
5858

tests/event/main_listener_base.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getDataSet()
7373
/**
7474
* {@inheritDoc}
7575
*/
76-
public function setUp()
76+
public function setUp(): void
7777
{
7878
parent::setUp();
7979

tests/functional/centering_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class centering_test extends functional_base
1818
/**
1919
* {@inheritDoc}
2020
*/
21-
public function setUp()
21+
public function setUp(): void
2222
{
2323
parent::setUp();
2424

tests/functional/content_only_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class content_only_test extends functional_base
1818
/**
1919
* {@inheritDoc}
2020
*/
21-
public function setUp()
21+
public function setUp(): void
2222
{
2323
parent::setUp();
2424

tests/functional/end_date_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class end_date_test extends functional_base
1818
/**
1919
* {@inheritDoc}
2020
*/
21-
public function setUp()
21+
public function setUp(): void
2222
{
2323
parent::setUp();
2424

tests/functional/functional_base.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected static function setup_extensions()
2626
/**
2727
* {@inheritDoc}
2828
*/
29-
public function setUp()
29+
public function setUp(): void
3030
{
3131
parent::setUp();
3232

tests/functional/start_date_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class start_date_test extends functional_base
1818
/**
1919
* {@inheritDoc}
2020
*/
21-
public function setUp()
21+
public function setUp(): void
2222
{
2323
parent::setUp();
2424

tests/functional/zbase_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class zbase_test extends functional_base
2323
/**
2424
* {@inheritDoc}
2525
*/
26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

travis/prepare-coverage.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ DB=$1
1212
TRAVIS_PHP_VERSION=$2
1313
EXTNAME=$3
1414

15-
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
15+
if [ "$TRAVIS_PHP_VERSION" == "7.2" ] && [ "$DB" == "mysqli" ]
1616
then
17-
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/$EXTNAME/travis/phpunit-mysqli-travis.xml &> phpBB/ext/$EXTNAME/travis/phpunit-mysqli-travis.xml.bak
18-
cp phpBB/ext/$EXTNAME/travis/phpunit-mysqli-travis.xml.bak phpBB/ext/$EXTNAME/travis/phpunit-mysqli-travis.xml
17+
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/migrations\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/"$EXTNAME"/travis/phpunit-mysqli-travis.xml &> phpBB/ext/"$EXTNAME"/travis/phpunit-mysqli-travis.xml.bak
18+
cp phpBB/ext/"$EXTNAME"/travis/phpunit-mysqli-travis.xml.bak phpBB/ext/"$EXTNAME"/travis/phpunit-mysqli-travis.xml
1919
fi

travis/prepare-epv.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -x
1414
EPV=$1
1515
NOTESTS=$2
1616

17-
if [ "$EPV" == "1" -a "$NOTESTS" == "1" ]
17+
if [ "$EPV" == "1" ] && [ "$NOTESTS" == "1" ]
1818
then
1919
cd phpBB
2020
composer remove sami/sami --update-with-dependencies --dev --no-interaction

travis/prepare-phpbb.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
set -e
1212
set -x
1313

14-
EXTNAME=$1
15-
BRANCH=$2
16-
EXTPATH_TEMP=$3
14+
BRANCH=$1
1715

1816
# Copy extension to a temp folder
1917
mkdir ../../tmp
2018
cp -R . ../../tmp
2119
cd ../../
2220

2321
# Clone phpBB
24-
git clone --depth=1 "git://github.com/phpbb/phpbb.git" "phpBB3" --branch=$BRANCH
22+
git clone --depth=1 "git://github.com/phpbb/phpbb.git" "phpBB3" --branch="$BRANCH"

travis/run-tests.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ DB=$1
1212
TRAVIS_PHP_VERSION=$2
1313
EXTNAME=$3
1414

15-
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
15+
if [ "$TRAVIS_PHP_VERSION" == "7.2" ] && [ "$DB" == "mysqli" ]
1616
then
17-
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
17+
phpBB/vendor/bin/phpunit --configuration phpBB/ext/"$EXTNAME"/travis/phpunit-"$DB"-travis.xml --bootstrap ./tests/bootstrap.php --coverage-clover build/logs/clover.xml
1818
else
19-
phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php
19+
phpBB/vendor/bin/phpunit --configuration phpBB/ext/"$EXTNAME"/travis/phpunit-"$DB"-travis.xml --bootstrap ./tests/bootstrap.php
2020
fi

travis/send-coverage.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ DB=$1
1212
TRAVIS_PHP_VERSION=$2
1313
GITREPO=$3
1414

15-
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
15+
if [ "$TRAVIS_PHP_VERSION" == "7.2" ] && [ "$DB" == "mysqli" ]
1616
then
17-
cd ../$GITREPO
17+
cd ../"$GITREPO"
1818
wget https://scrutinizer-ci.com/ocular.phar
1919
php ocular.phar code-coverage:upload --format=php-clover ../../phpBB3/build/logs/clover.xml
2020
fi

0 commit comments

Comments
 (0)