<?php

// Require some files 
require_once ('simpletest/unit_tester.php');
require_once ('simpletest/web_tester.php');
require_once ('simpletest/reporter.php');
require_once ('simpletest-addons/show-passes.php');            // modified HtmlReporter


// ======================== Configuration ==================================

// Base URLs to the main CAcert sites
define('BASE_URL',      'www.test2.cacert.at/');
//define('BASE_URL_WIKI', 'wiki.cacert.org/');    // Comment out to deactivate tests
//define('BASE_URL_BLOG', 'blog.cacert.org/');
//define('BASE_URL_BUGTRACKING', 'bugs.cacert.org/');


// ======================== Some users for Testing ========================

$user = array();

// unassured user
// used in login.php, lostpassword.php
//
// Behind this email address is a script that automatically follows
// any cacert-link so verify the account.
$user['1']['username'] = 'chris-test1.cacert.at@netzpunkt.org';
$user['1']['newemail'] = sprintf('chris-cacert-autofollowlink-%s@netzpunkt.org', time()+1);
$user['1']['details']['fname'] = 'Testaccount';
$user['1']['details']['mname'] = 'T.';
$user['1']['details']['lname'] = 'Testman';
$user['1']['details']['suffix'] = 'Ltd.';
$user['1']['password'] = 'q1W"e3R$';
$user['1']['dob']['day']   = '15';
$user['1']['dob']['month'] = '3';
$user['1']['dob']['year']  = '1960';
$user['1']['lostpw']['questions']['1'] = 'a';
$user['1']['lostpw']['questions']['2'] = 'b';
$user['1']['lostpw']['questions']['3'] = 'c';
$user['1']['lostpw']['questions']['4'] = 'd';
$user['1']['lostpw']['questions']['5'] = 'e';
$user['1']['lostpw']['answers']['1'] = '1';
$user['1']['lostpw']['answers']['2'] = '2';
$user['1']['lostpw']['answers']['3'] = '3';
$user['1']['lostpw']['answers']['4'] = '4';
$user['1']['lostpw']['answers']['5'] = '5';


// dummy for new user tests
// used in join.php
// Behind this email address is a script that automatically follows
// any cacert-link so verify the account.
$user['2']['username'] = sprintf('chris-cacert-autofollowlink-%s@netzpunkt.org', time()+2);
$user['2']['password'] = 'q1W"e3R$';
$user['2']['dob']      = $user['1']['dob'];
$user['2']['lostpw']   = $user['1']['lostpw'];
$user['2']['details']['fname'] = 'Join';
$user['2']['details']['mname'] = 'F.';
$user['2']['details']['lname'] = 'Testerdy';
$user['2']['details']['suffix'] = 'Jr';


// dummy for changing user details
// used in change-details-password.php
//
// This details are used to test changing user details. Login with any other user
// and change details to the following. Remember to change it back after testing.
$user['3']['dob1']['day']        = '25';
$user['3']['dob1']['month']      = '1';
$user['3']['dob1']['year']       = '1999';
$user['3']['details']['fname']   = 'Peter test 3';
$user['3']['details']['mname']   = 'P. test 3';
$user['3']['details']['lname']   = 'Peterson test 3';
$user['3']['details1']['suffix'] = 'Inc. test 3';
$user['3']['lostpw']['questions']['1'] = 'a test 3';
$user['3']['lostpw']['questions']['2'] = 'b test 3';
$user['3']['lostpw']['questions']['3'] = 'c test 3';
$user['3']['lostpw']['questions']['4'] = 'd test 3';
$user['3']['lostpw']['questions']['5'] = 'e test 3';
$user['3']['lostpw']['answers']['1'] = '1 test 3';
$user['3']['lostpw']['answers']['2'] = '2 test 3';
$user['3']['lostpw']['answers']['3'] = '3 test 3';
$user['3']['lostpw']['answers']['4'] = '4 test 3';
$user['3']['lostpw']['answers']['5'] = '5 test 3';
$user['3']['password'] = 'PY!S8(dHn';





$test = & new GroupTest('running tests on '.BASE_URL.' ...');


// You may deactivate specific tests by uncommenting one or more of the
// following lines.
//$test->addTestFile('testfiles/general-website.php');
//$test->addTestFile('testfiles/login.php');
//$test->addTestFile('testfiles/lostpassword.php');
//$test->addTestFile('testfiles/join.php');
//$test->addTestFile('testfiles/newemail.php');
//$test->addTestFile('testfiles/change-details-password.php');
//$test->addTestFile('testfiles/join-XSS.php');
$test->addTestFile('testfiles/change-details-XSS.php');


// ======================= Run Tests ====================================

if (TextReporter :: inCli()) {

	$test->run(new TextReporter());    // run in text mode

} else {

    $test->run(new ShowPasses());      // run in html mode - modified HtmlReporter showing Passes
#    $test->run(new HtmlReporter());    // run in html mode


}


?>