aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/dbal/write_sequence_test.php4
-rw-r--r--tests/search/mysql_test.php2
-rw-r--r--tests/search/native_test.php2
-rw-r--r--tests/search/postgres_test.php2
4 files changed, 7 insertions, 3 deletions
diff --git a/tests/dbal/write_sequence_test.php b/tests/dbal/write_sequence_test.php
index 8975cfbfb1..f382a971a5 100644
--- a/tests/dbal/write_sequence_test.php
+++ b/tests/dbal/write_sequence_test.php
@@ -33,6 +33,10 @@ class phpbb_dbal_write_sequence_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
+ // dbal uses cache
+ global $cache;
+ $cache = new phpbb_mock_cache();
+
$sql = 'INSERT INTO phpbb_users ' . $db->sql_build_array('INSERT', array(
'username' => $username,
'username_clean' => $username,
diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php
index 3ba3915714..3ad15bd806 100644
--- a/tests/search/mysql_test.php
+++ b/tests/search/mysql_test.php
@@ -26,7 +26,7 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
parent::setUp();
// dbal uses cache
- $cache = new phpbb_cache_service(new phpbb_cache_driver_null);
+ $cache = new phpbb_mock_cache();
// set config values
$config['fulltext_mysql_min_word_len'] = 4;
diff --git a/tests/search/native_test.php b/tests/search/native_test.php
index eeee3a44f3..4a2c210013 100644
--- a/tests/search/native_test.php
+++ b/tests/search/native_test.php
@@ -26,7 +26,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
parent::setUp();
// dbal uses cache
- $cache = new phpbb_cache_service(new phpbb_cache_driver_null);
+ $cache = new phpbb_mock_cache();
$this->db = $this->new_dbal();
$error = null;
diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php
index 9c77e0c09e..923af6f854 100644
--- a/tests/search/postgres_test.php
+++ b/tests/search/postgres_test.php
@@ -26,7 +26,7 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
parent::setUp();
// dbal uses cache
- $cache = new phpbb_cache_service(new phpbb_cache_driver_null);
+ $cache = new phpbb_mock_cache();
// set config values
$config['fulltext_postgres_min_word_len'] = 4;
n171'>171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
package mdkonline;

use strict;
use MIME::Base64 qw(encode_base64);

use lib qw(/usr/lib/libDrakX);
use c;
use common;

use LWP::UserAgent;         
use Net::HTTPS;
use HTTP::Request::Common;
use HTTP::Request;

#Don't change version manually
$::VERSION = '1.1-13mdk';

sub get_release() {
    my ($release) = cat_('/etc/mandrake-release') =~ /release\s+(\S+)/;
    ($release)
}

sub get_from_URL {
    my ($link, $agent_name) = @_;
    my $ua = LWP::UserAgent->new;
    $ua->agent($agent_name . $ua->agent . $::VERSION);
    $ua->env_proxy;
    my $request = HTTP::Request->new(GET => $link);
    my $response = $ua->request($request);
    $response
}

sub get_site {
    my $link = shift;
    $link .= join('', @_);
    my $b = browser();
    system("$b " . $link . "&")
}

sub browser {
    require any;
    my $wm = any::running_window_manager();
    member ($wm, 'kwin', 'gnome-session') or $wm = 'other';
    my %Br = (
	      'kwin' => 'webclient-kde',
	      'gnome-session' => 'webclient-gnome',
	      'other' => $ENV{BROWSER} || find { -x "/usr/bin/$_"} qw(epiphany mozilla konqueror galeon)
	     );
    $Br{$wm}
}

sub subscribe_online {
    my ($full_link) = shift;
    my $ret = get_from_URL($full_link, "MdkOnlineAgent/");
    my $str;
    my $result = {
		  10 => 'OK',
		  11 => N("Login and password should be less than 12 characters\n"),
		  12 => N("Special characters are not allowed\n"),
		  13 => N("Please fill in all fields\n"),
		  14 => N("Email not valid\n"),
		  15 => N("Account already exist\n"),
		 };
    if ($ret->is_success) {
	my $content = $ret->content;
#	    print "CODE_RETOUR = $content\n";
	if ($content =~ m/(\d+)/) { my $code = sprintf("%d",$1); $str = $result->{$code} }
    } else { $str = N("Problem connecting to server \n") }
    $str
}

sub check_valid_email {
    my $email = shift;
    my $st = $email = ~/^[a-z][a-z0-9_\-]+(\.[a-z][a-z0-9_]+)?@([a-z][a-z0-9_\-]+\.){1,3}(\w{2,4})(\.[a-z]{2})?$/ix ? 1 : 0;
    return $st
}

sub rpm_ver_parse {
    my ($ver) = @_;
    my @verparts = ();
    while ( $ver ne "" ) {
        if ( $ver =~ /^([A-Za-z]+)/ ) {    # leading letters
            push ( @verparts, $1 );
            $ver =~ s/^[A-Za-z]+//;
        }
        elsif ( $ver =~ /^(\d+)/ ) {       # leading digits
            push ( @verparts, $1 );
            $ver =~ s/^\d+//;
        }
        else {                             # remove non-letter, non-digit
            $ver =~ s/^.//;
        }
    }
    return @verparts;
}

sub rpm_ver_cmp {
    my ($a, $b) = @_;
    # list of version/release tokens
    my @aparts;
    my @bparts;
    # individual token from array
    my ($apart, $bpart, $result);
    if ( $a eq $b ) {
        return 0;
    }
    @aparts = rpmverparse($a); 
    @bparts = rpmverparse($b); 
    while ( @aparts && @bparts ) {
        $apart = shift (@aparts);
        $bpart = shift (@bparts);
	if ( $apart =~ /^\d+$/ && $bpart =~ /^\d+$/ ) {    # numeric
            if ( $result = ( $apart <=> $bpart ) ) {
                return $result;
            }
        }
        elsif ( $apart =~ /^[A-Za-z]+/ && $bpart =~ /^[A-Za-z]+/ ) {    # alpha
            if ( $result = ( $apart cmp $bpart ) ) {
                return $result;
            }
        }
        else {    # "arbitrary" in original code
	    my $rema = shift(@aparts);
	    my $remb = shift(@bparts);
	    if ($rema && !$remb) { return 1 } elsif (!$rema && $remb) { return -1 }
	    #return -1;
        }
    }
    # left over stuff in a or b, assume one of the two is newer
    if (@aparts) { return 1 } elsif (@bparts) {	return -1 } else { return 0 }
}

sub report_config {
    my $file = shift;  
sub header { "            
********************************************************************************
* $_[0]