Skip to content

Commit

Permalink
Switch to phpBB's test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
iMattPro committed Jun 12, 2014
1 parent f414f80 commit 5af2c59
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 160 deletions.
8 changes: 5 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
tests/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
travis/ export-ignore
.travis.yml export-ignore
gulpfile.js export-ignore
.gitignore export-ignore
.gitattributes export-ignore
package.json export-ignore
gulpfile.js export-ignore
phpunit.xml.dist export-ignore
72 changes: 46 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
language: php
php:
- 5.3
- 5.4
- 5.5
# 5.6

env:
- DB=mysql

before_script:
# MUST UPDATE THIS FOR YOUR EXTENSION
- VENDOR="vse"
- NAME="abbc3"

# clone test framework
- git clone "git://github.com/phpbb-extensions/test-framework.git" "./../../test-framework"

# run the prepare-travis.sh file from the cloned repo to finish the setup
- ./../../test-framework/prepare-travis.sh "$VENDOR" "$NAME" "$DB"

# Go to the root phpBB repository that was cloned from prepare-travis.sh,
# so the script path and relative paths are correct
- cd ../../phpbb

script:
- ./phpBB/vendor/bin/phpunit --configuration ./phpBB/ext/$VENDOR/$NAME/travis/phpunit-$DB-travis.xml

matrix:
include:
- php: 5.3.3
env: DB=mysqli
- php: 5.3
env: DB=mysqli # MyISAM
- php: 5.4
env: DB=mysqli
- php: 5.4
env: DB=mysql
- php: 5.4
env: DB=mariadb
- php: 5.4
env: DB=postgres
- php: 5.4
env: DB=sqlite3
- php: 5.5
env: DB=mysqli
- php: 5.6
env: DB=mysqli
- php: hhvm
env: DB=mysqli
allow_failures:
- php: hhvm
fast_finish: true

env:
global:
- EXTNAME="vse/abbc3"
- SNIFF="0" # Should we run code sniffer on your code?
- IMAGE_ICC="1" # Should we run icc profile sniffer on your images?
- PHPBB_BRANCH="develop-ascraeus"

#branches:
# only:
# - master
# - develop
# - /^develop-.*$/

install:
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
- cd ../../phpBB3
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION

before_script:
- travis/setup-database.sh $DB $TRAVIS_PHP_VERSION

script:
- sh -c "if [ '$SNIFF' != '0' ]; then travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION; fi"
- 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
5 changes: 5 additions & 0 deletions migrations/v310_m1_remove_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public function effectively_installed()
return $module_id == false;
}

static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\beta4');
}

public function update_data()
{
return array(
Expand Down
38 changes: 38 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="true"
backupStaticAttributes="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
verbose="true"
bootstrap="../../../../tests/bootstrap.php"
>
<testsuites>
<testsuite name="Extension Test Suite">
<directory suffix="_test.php">./tests</directory>
<exclude>./tests/functional</exclude>
</testsuite>
<testsuite name="Extension Functional Tests">
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">./tests/functional/</directory>
</testsuite>
</testsuites>

<filter>
<blacklist>
<directory>./tests/</directory>
</blacklist>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./</directory>
<exclude>
<directory suffix=".php">./language/</directory>
<directory suffix=".php">./migrations/</directory>
<directory suffix=".php">./tests/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
7 changes: 6 additions & 1 deletion tests/core/acp_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@

namespace vse\abbc3\tests\core;

class acp_base extends \extension_database_test_case
class acp_base extends \phpbb_database_test_case
{
static protected function setup_extensions()
{
return array('vse/abbc3');
}

protected $db;
protected $request;
protected $user;
Expand Down
7 changes: 6 additions & 1 deletion tests/core/bbcodes_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@

namespace vse\abbc3\tests\core;

class bbcodes_test extends \extension_database_test_case
class bbcodes_test extends \phpbb_database_test_case
{
static protected function setup_extensions()
{
return array('vse/abbc3');
}

protected $db;
protected $user;
protected $root_path;
Expand Down
9 changes: 6 additions & 3 deletions tests/functional/acp_bbcodes_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
/**
* @group functional
*/
class acp_bbcodes_test extends \extension_functional_test_case
class acp_bbcodes_test extends \phpbb_functional_test_case
{
static protected function setup_extensions()
{
return array('vse/abbc3');
}

public function setUp()
{
parent::setUp();
$this->login();
$this->admin_login();
$this->set_extension('vse', 'abbc3', 'Advanced BBCode Box');
$this->enable_extension();
}

/**
Expand Down
10 changes: 6 additions & 4 deletions tests/functional/bbcode_editor_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
/**
* @group functional
*/
class bbcode_editor_test extends \extension_functional_test_case
class bbcode_editor_test extends \phpbb_functional_test_case
{
static protected function setup_extensions()
{
return array('vse/abbc3');
}

public function setUp()
{
parent::setUp();
$this->login();
$this->admin_login();
$this->set_extension('vse', 'abbc3', 'Advanced BBCode Box');
$this->enable_extension();
}

/**
Expand Down
12 changes: 5 additions & 7 deletions tests/functional/bbcode_posting_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
/**
* @group functional
*/
class bbcode_posting_test extends \extension_functional_test_case
class bbcode_posting_test extends \phpbb_functional_test_case
{
public function setUp()
static protected function setup_extensions()
{
parent::setUp();
$this->login();
$this->admin_login();
$this->set_extension('vse', 'abbc3', 'Advanced BBCode Box');
$this->enable_extension();
return array('vse/abbc3');
}

/**
Expand All @@ -30,6 +26,8 @@ public function setUp()
*/
public function test_posting_custom_bbcode()
{
$this->login();

// Test creating a post with our Highlight BBCode
$post = $this->create_topic(2, 'Test Topic 1', '[highlight=yellow]This is a test topic posted by the testing framework.[/highlight]');

Expand Down
38 changes: 0 additions & 38 deletions tests/functional/extension_base_test.php

This file was deleted.

21 changes: 0 additions & 21 deletions tests/system/base_test.php

This file was deleted.

43 changes: 0 additions & 43 deletions tests/system/database_base_test.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/system/fixtures/config.xml

This file was deleted.

24 changes: 24 additions & 0 deletions travis/prepare-phpbb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @license GNU General Public License, version 2 (GPL-2.0)
#
# For full copyright and license information, please see
# the docs/CREDITS.txt file.
#
set -e
set -x

EXTNAME=$1
BRANCH=$2
EXTPATH_TEMP=$3

# Copy extension to a temp folder
mkdir ../../tmp
cp -R . ../../tmp
cd ../../

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

0 comments on commit 5af2c59

Please sign in to comment.