Add a script to run all tests, fix errors when running tests in non-kolab env
This commit is contained in:
parent
07554a5db0
commit
4082f72a54
4 changed files with 92 additions and 0 deletions
|
@ -36,6 +36,10 @@ class kolab_date_recurrence_test extends PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
function test_first_occurrence($recurrence_data, $start, $expected)
|
function test_first_occurrence($recurrence_data, $start, $expected)
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$start = new DateTime($start);
|
$start = new DateTime($start);
|
||||||
if (!empty($recurrence_data['UNTIL'])) {
|
if (!empty($recurrence_data['UNTIL'])) {
|
||||||
$recurrence_data['UNTIL'] = new DateTime($recurrence_data['UNTIL']);
|
$recurrence_data['UNTIL'] = new DateTime($recurrence_data['UNTIL']);
|
||||||
|
@ -216,6 +220,10 @@ class kolab_date_recurrence_test extends PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
function test_first_occurrence_allday($recurrence_data, $start, $expected)
|
function test_first_occurrence_allday($recurrence_data, $start, $expected)
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$start = new DateTime($start);
|
$start = new DateTime($start);
|
||||||
if (!empty($recurrence_data['UNTIL'])) {
|
if (!empty($recurrence_data['UNTIL'])) {
|
||||||
$recurrence_data['UNTIL'] = new DateTime($recurrence_data['UNTIL']);
|
$recurrence_data['UNTIL'] = new DateTime($recurrence_data['UNTIL']);
|
||||||
|
@ -236,6 +244,10 @@ class kolab_date_recurrence_test extends PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
function test_next_instance()
|
function test_next_instance()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
date_default_timezone_set('America/New_York');
|
date_default_timezone_set('America/New_York');
|
||||||
|
|
||||||
$start = new DateTime('2017-08-31 11:00:00', new DateTimeZone('Europe/Berlin'));
|
$start = new DateTime('2017-08-31 11:00:00', new DateTimeZone('Europe/Berlin'));
|
||||||
|
|
|
@ -34,6 +34,10 @@ class kolab_storage_config_test extends PHPUnit_Framework_TestCase
|
||||||
$rcube = rcmail::get_instance();
|
$rcube = rcmail::get_instance();
|
||||||
$rcube->plugins->load_plugin('libkolab', true, true);
|
$rcube->plugins->load_plugin('libkolab', true, true);
|
||||||
|
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($rcube->config->get('tests_username')) {
|
if ($rcube->config->get('tests_username')) {
|
||||||
$authenticated = $rcube->login(
|
$authenticated = $rcube->login(
|
||||||
$rcube->config->get('tests_username'),
|
$rcube->config->get('tests_username'),
|
||||||
|
@ -70,6 +74,10 @@ class kolab_storage_config_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_001_build_member_url()
|
function test_001_build_member_url()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$rcube = rcube::get_instance();
|
$rcube = rcube::get_instance();
|
||||||
$email = $rcube->get_user_email();
|
$email = $rcube->get_user_email();
|
||||||
$personal = str_replace('$user', urlencode($email), $this->url_personal);
|
$personal = str_replace('$user', urlencode($email), $this->url_personal);
|
||||||
|
@ -89,6 +97,10 @@ class kolab_storage_config_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_002_parse_member_url()
|
function test_002_parse_member_url()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$rcube = rcube::get_instance();
|
$rcube = rcube::get_instance();
|
||||||
$email = $rcube->get_user_email();
|
$email = $rcube->get_user_email();
|
||||||
$personal = str_replace('$user', urlencode($email), $this->url_personal);
|
$personal = str_replace('$user', urlencode($email), $this->url_personal);
|
||||||
|
@ -113,6 +125,10 @@ class kolab_storage_config_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_003_build_parse_member_url()
|
function test_003_build_parse_member_url()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
// personal namespace
|
// personal namespace
|
||||||
$params = $this->params_personal;
|
$params = $this->params_personal;
|
||||||
$params_ = kolab_storage_config::parse_member_url(kolab_storage_config::build_member_url($params));
|
$params_ = kolab_storage_config::parse_member_url(kolab_storage_config::build_member_url($params));
|
||||||
|
@ -138,6 +154,10 @@ class kolab_storage_config_test extends PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
function test_save()
|
function test_save()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$config = kolab_storage_config::get_instance();
|
$config = kolab_storage_config::get_instance();
|
||||||
$tags = array(
|
$tags = array(
|
||||||
array(
|
array(
|
||||||
|
@ -171,6 +191,10 @@ class kolab_storage_config_test extends PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
function test_T133()
|
function test_T133()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$config = kolab_storage_config::get_instance();
|
$config = kolab_storage_config::get_instance();
|
||||||
|
|
||||||
// get tags
|
// get tags
|
||||||
|
|
|
@ -29,6 +29,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$rcmail->plugins->load_plugin('libkolab', true, true);
|
$rcmail->plugins->load_plugin('libkolab', true, true);
|
||||||
|
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($rcmail->config->get('tests_username')) {
|
if ($rcmail->config->get('tests_username')) {
|
||||||
$authenticated = $rcmail->login(
|
$authenticated = $rcmail->login(
|
||||||
$rcmail->config->get('tests_username'),
|
$rcmail->config->get('tests_username'),
|
||||||
|
@ -65,6 +69,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_001_folder_type_check()
|
function test_001_folder_type_check()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$folder = new kolab_storage_folder('Calendar', 'event', 'event.default');
|
$folder = new kolab_storage_folder('Calendar', 'event', 'event.default');
|
||||||
$this->assertTrue($folder->valid);
|
$this->assertTrue($folder->valid);
|
||||||
$this->assertEquals($folder->get_error(), 0);
|
$this->assertEquals($folder->get_error(), 0);
|
||||||
|
@ -80,6 +88,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_002_get_owner()
|
function test_002_get_owner()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$folder = new kolab_storage_folder('Calendar', 'event', 'event');
|
$folder = new kolab_storage_folder('Calendar', 'event', 'event');
|
||||||
$this->assertEquals($folder->get_owner(), $rcmail->config->get('tests_username'));
|
$this->assertEquals($folder->get_owner(), $rcmail->config->get('tests_username'));
|
||||||
|
@ -97,6 +109,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_003_get_resource_uri()
|
function test_003_get_resource_uri()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$foldername = 'Calendar';
|
$foldername = 'Calendar';
|
||||||
$uri = parse_url($rcmail->config->get('default_host'));
|
$uri = parse_url($rcmail->config->get('default_host'));
|
||||||
|
@ -112,6 +128,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_004_get_uid()
|
function test_004_get_uid()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$folder = new kolab_storage_folder('Doesnt-Exist', 'event', 'event');
|
$folder = new kolab_storage_folder('Doesnt-Exist', 'event', 'event');
|
||||||
|
|
||||||
|
@ -123,6 +143,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_005_subscribe()
|
function test_005_subscribe()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$folder = new kolab_storage_folder('Contacts', 'contact');
|
$folder = new kolab_storage_folder('Contacts', 'contact');
|
||||||
$this->assertTrue($folder->subscribe(true));
|
$this->assertTrue($folder->subscribe(true));
|
||||||
$this->assertTrue($folder->is_subscribed());
|
$this->assertTrue($folder->is_subscribed());
|
||||||
|
@ -135,6 +159,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_006_activate()
|
function test_006_activate()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$folder = new kolab_storage_folder('Calendar', 'event');
|
$folder = new kolab_storage_folder('Calendar', 'event');
|
||||||
$this->assertTrue($folder->activate(true));
|
$this->assertTrue($folder->activate(true));
|
||||||
$this->assertTrue($folder->is_active());
|
$this->assertTrue($folder->is_active());
|
||||||
|
@ -145,6 +173,10 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
function test_010_write_contacts()
|
function test_010_write_contacts()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$contacts = array(
|
$contacts = array(
|
||||||
'name' => 'FN',
|
'name' => 'FN',
|
||||||
'surname' => 'Last',
|
'surname' => 'Last',
|
||||||
|
@ -164,12 +196,20 @@ class kolab_storage_folder_test extends PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
function test_011_list_contacts()
|
function test_011_list_contacts()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$folder = new kolab_storage_folder('Contacts', 'contact');
|
$folder = new kolab_storage_folder('Contacts', 'contact');
|
||||||
$this->assertEquals($folder->count(), 1);
|
$this->assertEquals($folder->count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_T491_get_uid()
|
function test_T491_get_uid()
|
||||||
{
|
{
|
||||||
|
if (!kolab_format::supports(3)) {
|
||||||
|
$this->markTestSkipped('No Kolab support');
|
||||||
|
}
|
||||||
|
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$imap = $rcmail->get_storage();
|
$imap = $rcmail->get_storage();
|
||||||
$db = $rcmail->get_dbh();
|
$db = $rcmail->get_dbh();
|
||||||
|
|
16
run-tests.sh
Executable file
16
run-tests.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PHPUNIT=`which phpunit`
|
||||||
|
|
||||||
|
if [ -f "vendor/phpunit/phpunit/phpunit" ]; then
|
||||||
|
PHPUNIT="../vendor/phpunit/phpunit/phpunit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd tests
|
||||||
|
|
||||||
|
$PHPUNIT ../plugins/libkolab/tests/kolab_date_recurrence.php
|
||||||
|
$PHPUNIT ../plugins/libkolab/tests/kolab_storage_config.php
|
||||||
|
$PHPUNIT ../plugins/libkolab/tests/kolab_storage_folder.php
|
||||||
|
|
||||||
|
$PHPUNIT ../plugins/libcalendaring/tests/libcalendaring.php
|
||||||
|
$PHPUNIT ../plugins/libcalendaring/tests/libvcalendar.php
|
Loading…
Add table
Reference in a new issue