Skip to content

Commit

Permalink
[task/phpunit-xml] Use phpunit.xml for test suite
Browse files Browse the repository at this point in the history
PHPBB3-9967
  • Loading branch information
igorw committed Jan 4, 2011
1 parent c54683b commit 9a52bd0
Show file tree
Hide file tree
Showing 34 changed files with 80 additions and 506 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*~
phpunit.xml
phpBB/cache/*.php
phpBB/config.php
phpBB/files/*
Expand Down
11 changes: 5 additions & 6 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@
<delete dir="build/save" />
</target>

<target name="test">
<exec dir="tests"
command="phpunit --log-junit ../build/logs/phpunit.xml
--coverage-clover ../build/logs/clover.xml
--coverage-html ../build/coverage
phpbb_all_tests all_tests.php"
<target name="test" depends="clean,prepare">
<exec dir="."
command="phpunit --log-junit build/logs/phpunit.xml
--coverage-clover build/logs/clover.xml
--coverage-html build/coverage"
passthru="true" />


Expand Down
34 changes: 34 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="true"
backupStaticAttributes="true"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>

<filter>
<blacklist>
<directory>./tests/</directory>
<directory>./phpBB/</directory>
</blacklist>
<whitelist>
<directory>./phpBB/includes/db/</directory>
<file>./phpBB/includes/utf/utf_tools.php</file>
<file>./phpBB/includes/functions.php</file>
<file>./phpBB/includes/functions_content.php</file>
<file>./phpBB/includes/session.php</file>
<file>./phpBB/includes/template.php</file>
</whitelist>
</filter>
</phpunit>
8 changes: 4 additions & 4 deletions tests/RUNNING_TESTS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Prerequisites
PHPUnit
-------

phpBB unit tests use PHPUnit framework. Version 3.3 or better is required
phpBB unit tests use PHPUnit framework. Version 3.5 or better is required
to run the tests. PHPUnit prefers to be installed via PEAR; refer to
http://www.phpunit.de/ for more information.

Expand Down Expand Up @@ -41,14 +41,14 @@ will run phpunit with the same parameters as in the shown test_config.php file:

$ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \
PHPBB_TEST_DBNAME='database' PHPBB_TEST_DBUSER='user' \
PHPBB_TEST_DBPASSWD='password' phpunit all_tests.php
PHPBB_TEST_DBPASSWD='password' phpunit

Running
=======

Once the prerequisites are installed, run the tests from tests directory:
Once the prerequisites are installed, run the tests from the project root directory (above phpBB):

$ phpunit all_tests.php
$ phpunit

More Information
================
Expand Down
69 changes: 0 additions & 69 deletions tests/all_tests.php

This file was deleted.

15 changes: 1 addition & 14 deletions tests/test_framework/framework.php → tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

define('IN_PHPBB', true);
$phpbb_root_path = '../phpBB/';
$phpbb_root_path = 'phpBB/';
$phpEx = 'php';
$table_prefix = '';

Expand All @@ -25,19 +25,6 @@

require_once $phpbb_root_path . 'includes/constants.php';

// require at least PHPUnit 3.3.0
require_once 'PHPUnit/Runner/Version.php';
if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', '<'))
{
trigger_error('PHPUnit >= 3.3.0 required');
}

if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<'))
{
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/Database/TestCase.php';
}

require_once 'test_framework/phpbb_test_case_helpers.php';
require_once 'test_framework/phpbb_test_case.php';
require_once 'test_framework/phpbb_database_test_case.php';
42 changes: 0 additions & 42 deletions tests/dbal/all_tests.php

This file was deleted.

3 changes: 1 addition & 2 deletions tests/dbal/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*
*/

require_once 'test_framework/framework.php';
require_once '../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/functions.php';

class phpbb_dbal_select_test extends phpbb_database_test_case
{
Expand Down
3 changes: 1 addition & 2 deletions tests/dbal/write.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*
*/

require_once 'test_framework/framework.php';
require_once '../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/functions.php';

class phpbb_dbal_write_test extends phpbb_database_test_case
{
Expand Down
40 changes: 0 additions & 40 deletions tests/network/all_tests.php

This file was deleted.

3 changes: 1 addition & 2 deletions tests/network/checkdnsrr.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*
*/

require_once 'test_framework/framework.php';
require_once '../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/functions.php';

class phpbb_network_checkdnsrr_test extends phpbb_test_case
{
Expand Down
40 changes: 0 additions & 40 deletions tests/random/all_tests.php

This file was deleted.

3 changes: 1 addition & 2 deletions tests/random/gen_rand_string.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*
*/

require_once 'test_framework/framework.php';
require_once '../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/functions.php';

class phpbb_random_gen_rand_string_test extends phpbb_test_case
{
Expand Down
46 changes: 0 additions & 46 deletions tests/regex/all_tests.php

This file was deleted.

Loading

0 comments on commit 9a52bd0

Please sign in to comment.