Beispiel #1
0
test('Cached value should exist');
asrt(apc_exists("configList"), "configList does not exist");
test('Should set cached value');
$list = apc_fetch("configList");
$passed = in_array('register', $list) && in_array('login', $list);
asrt($passed, http_build_query($list));
$writeconfig = file('register.example');
$readconfig = file('login.example');
require_once 'functions_main.inc';
testSuite('Read config test');
test('Should throw error on empty parameters');
readConfig(false);
throws("no action provided");
test('Should throw error on nonexistent action');
readConfig('some_weird_action');
throws("unrecognized action");
test('Action exists, but no file for it');
readConfig('login');
throws("unable to find config for this action");
test('Action exists, but no file for it');
$passed = readConfig('login', '.example');
asrt(startsWith($passed[0], 'IMPORT'), $passed[0]);
testSuite('Test import');
test('Should throw error on empty parameters');
$toParse[0] = 'IMPORT login.example';
$toParse[1] = 'DBCONFIG best : mana';
$parsed = doIMPORT($toParse);
$dbConfig = getDbConfigs($parsed);
$passed = $dbConfig['best'] == 'mana' && $dbConfig['user'] == 'loginreader';
asrt($passed, http_build_query($dbConfig));
finish();
Beispiel #2
0
<?php

require_once 'functions_utility.inc';
require_once 'functions_main.inc';
$configLinesWithoutIncludes = readConfig($_GET["action"]);
checkIfError();
$configLinesWithIncludes = doIMPORT($configLinesWithoutIncludes);
checkIfError();
$linesToParse = stripComments($configLinesWithIncludes);
checkIfError();
checkMETHOD($linesToParse);
checkIfError();
$passedVariables = MapVariables($linesToParse);
checkIfError();
doCHECK($linesToParse, $passedVariables);
checkIfError();
$sqlConnection = initDB($linesToParse);
checkIfError();
doDBCHECK($linesToParse, $sqlConnection);
checkIfError();
doACTION($linesToParse, $sqlConnection);
checkIfError();