[Customisation Database Commits] [customisation-db][001] [task/testsuite] Add test suite to titania
Michael Cullum
unknownbliss at phpbbdevelopers.net
Wed Mar 21 14:43:48 GMT 2012
commit 54ea9399cab9716a466246d42830046b3cb960e1
Author: Michael Cullum <unknownbliss at phpbbdevelopers.net>
Date: Tue Mar 13 19:50:09 2012 +0000
[task/testsuite] Add test suite to titania
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..4125b6d
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "test/vendor/phpBB"]
+ path = test/vendor/phpBB
+ url = git://github.com/phpbb/phpbb3.git
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..f56db74
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@
+language: php
+php:
+ - 5.2
+ - 5.3
+
+env:
+ - DB=mysql
+
+before_script:
+ - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS cdb_tests;'; fi"
+ - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; fi"
+ - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3' ]; then pyrus install --force phpunit/DbUnit; fi"
+ - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ]; then pyrus install --force phpunit/DbUnit; fi"
+ - phpenv rehash
+ - git submodule update --init
+
+script:
+ - phpunit --configuration tests/travis/$DB.travis.xml
+
+notifications:
+ email:
+ recipients:
+ - m at michaelcullum.com
+ on_success: always
+ on_failure: always
+
+ irc:
+ channels:
+ - "irc.freenode.org#unknownbliss"
+ on_success: always
+ on_failure: always
+
+branches:
+ only:
+ task/testsuite
diff --git a/test/boostrap.php b/test/boostrap.php
new file mode 100644
index 0000000..8caa5e3
--- /dev/null
+++ b/test/boostrap.php
@@ -0,0 +1,53 @@
+<?php
+/**
+*
+* Titania Test Suite
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+// Define some initial constants
+define('CDBPATH', __DIR__ . '/../titania/');
+define('PHPBB_FILES', CDBPATH . 'phpBB/');
+define('IN_TEST', true);
+
+// Some to make phpBB files accessable in the first place
+$phpbb_root_path = CDBPATH . '../';
+$phpEx = 'php';
+define('IN_PHPBB', true);
+
+// Map the db constants to the phpBB vars
+if (!defined('dbms'))
+{
+ define('dbms', 'sqlite');
+ define('dbhost', __DIR__ . '/unit_tests.sqlite2'); // filename
+ define('dbuser', '');
+ define('dbpasswd', '');
+ define('dbname', '');
+ define('dbport', '');
+ define('table_prefix', '');
+}
+$dbms = dbms;
+
+$phpbb_tests_path = CDBPATH . 'vendor/phpBB/tests/';
+$phpEx = 'php';
+
+$table_prefix = (!defined('table_prefix')) ? 'phpbb_' : table_prefix;
+
+require_once $phpbb_tests_path . 'test_framework/phpbb_test_case_helpers.php';
+require_once $phpbb_tests_path . 'test_framework/phpbb_test_case.php';
+require_once $phpbb_tests_path . 'test_framework/phpbb_database_test_case.php';
+require_once $phpbb_tests_path . 'test_framework/phpbb_database_test_connection_manager.php';
+
+require_once __DIR__ . '/test_framework/cdb_database_test_case.php';
+require_once __DIR__ . '/test_framework/cdb_database_test_connection_manager.php';
+require_once __DIR__ . '/test_framework/cdb_test_case.php';
+
+require_once PHPBB_FILES . 'includes/class_loader.' . $phpEx;
+$cdb_class_loader = new phpbb_class_loader('cdb_', CDBPATH);
+$cdb_class_loader->register();
+$phpbb_class_loader = new phpbb_class_loader('phpbb_', PHPBB_FILES . 'includes/');
+$phpbb_class_loader->register();
diff --git a/test/test_framework/cdb_database_test_case.php b/test/test_framework/cdb_database_test_case.php
new file mode 100644
index 0000000..3ce3487
--- /dev/null
+++ b/test/test_framework/cdb_database_test_case.php
@@ -0,0 +1,44 @@
+<?php
+
+abstract class cdb_database_test_case extends phpbb_database_test_case
+{
+ public function __construct($name = NULL, array $data = array(), $dataName = '')
+ {
+ parent::__construct($name, $data, $dataName);
+ }
+
+ public function get_database_config()
+ {
+ $config = array();
+
+ if (!defined('dbms'))
+ {
+ $config = array_merge($config, array(
+ 'dbms' => 'sqlite',
+ 'dbhost' => dirname(__FILE__) . '/../blog_unit_tests.sqlite2', // filename
+ 'dbport' => '',
+ 'dbname' => '',
+ 'dbuser' => '',
+ 'dbpasswd' => '',
+ ));
+ }
+ else
+ {
+ $config = array_merge($config, array(
+ 'dbms' => dbms,
+ 'dbhost' => dbhost,
+ 'dbport' => dbport,
+ 'dbname' => dbname,
+ 'dbuser' => dbuser,
+ 'dbpasswd' => dbpasswd,
+ ));
+ }
+
+ return $config;
+ }
+
+ protected function create_connection_manager($config)
+ {
+ return new cdb_database_test_connection_manager($config);
+ }
+}
diff --git a/test/test_framework/cdb_database_test_connection_manager.php b/test/test_framework/cdb_database_test_connection_manager.php
new file mode 100644
index 0000000..ab7003a
--- /dev/null
+++ b/test/test_framework/cdb_database_test_connection_manager.php
@@ -0,0 +1,9 @@
+<?php
+
+class cdb_database_test_connection_manager extends phpbb_database_test_connection_manager
+{
+ public function __construct($config)
+ {
+ parent::__construct($config);
+ }
+}
diff --git a/test/test_framework/cdb_test_case.php b/test/test_framework/cdb_test_case.php
new file mode 100644
index 0000000..eec875b
--- /dev/null
+++ b/test/test_framework/cdb_test_case.php
@@ -0,0 +1,9 @@
+<?php
+
+abstract class cdb_test_case extends phpbb_test_case
+{
+ public function __construct($name = NULL, array $data = array(), $dataName = '')
+ {
+ parent::__construct($name, $data, $dataName);
+ }
+}
diff --git a/test/tests/test.php b/test/tests/test.php
new file mode 100644
index 0000000..1b31b6c
--- /dev/null
+++ b/test/tests/test.php
@@ -0,0 +1,9 @@
+<?php
+
+class travis_test extends cdb_test_case
+{
+ public function test_t()
+ {
+ $this->assertTrue(true);
+ }
+}
diff --git a/test/travis/mysql.travis.xml b/test/travis/mysql.travis.xml
new file mode 100644
index 0000000..e90fc7e
--- /dev/null
+++ b/test/travis/mysql.travis.xml
@@ -0,0 +1,28 @@
+<?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="true"
+ strict="true"
+ bootstrap="../bootstrap.php">
+ <testsuites>
+ <testsuite name="Titania test suite">
+ <directory suffix="_test.php">./../tests/</directory>
+ </testsuite>
+ </testsuites>
+
+ <php>
+ <const name="dbms" value="mysqli"/>
+ <const name="dbhost" value="0.0.0.0" />
+ <const name="dbport" value="3306" />
+ <const name="dbname" value="cdb_tests" />
+ <const name="dbuser" value="root" />
+ <const name="dbpasswd" value="" />
+ <const name="table_prefix" value="phpbb_"/>
+ </php>
+</phpunit>
diff --git a/test/vendor/phpBB b/test/vendor/phpBB
new file mode 160000
index 0000000..b652e1a
--- /dev/null
+++ b/test/vendor/phpBB
@@ -0,0 +1 @@
+Subproject commit b652e1a1bb31512fad1cf315f7c4d475141191f9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://code.phpbb.com/pipermail/customisationdb-commits/attachments/20120321/0409c8e0/attachment-0001.htm>
More information about the customisationdb-commits
mailing list