14 set_include_path(get_include_path() . PATH_SEPARATOR .
"$pubdir/DCPTEST:$pubdir/WHAT");
15 require_once
'WHAT/autoload.php';
16 include_once (
"FDL/Class.Doc.php");
49 $this->
log(sprintf(
"========== %s ========", $this->getName()));
62 public static function log($text)
64 file_put_contents(
TestSuiteDcp::logFile, sprintf(
"[%s] %s\n", date(
"Y-m-d H:i:s") , $text) , FILE_APPEND);
77 self::$odb->savePoint(
'putransaction');
89 self::$odb->rollbackPoint(
'putransaction');
119 if (!$action->dbid) {
120 if (!$action->dbid) $action->init_dbid();
121 if (!$action->dbid) error_log(__METHOD__ .
"lost action dbid");
122 $action->init_dbid();
133 if ($action)
return $action->parent;
146 $this->assertEquals(
"",
$err, sprintf(
"database select error",
$sql));
168 if (!$u->setLoginName(
$login)) {
169 throw new \Dcp\Exception(
"login $login not exist");
175 self::resetDocumentCache();
200 if (is_array(
$file)) {
201 return self::importDocuments(
$file);
207 if (
$ext ==
"ods" ||
$ext ==
"csv") {
214 throw new \Dcp\Exception(sprintf(
"File '%s' not found in '%s'.",
$file,
$realfile));
217 $oImport->setCsvOptions(static::$importCsvSeparator, static::$importCsvEnclosure);
219 $oImport->setVerifyAttributeAccess(
false);
222 if (
$err)
throw new \Dcp\Exception(
$err);
233 if (!is_array($fileList)) {
234 $cr[] = self::importDocument($fileList);
238 foreach ($fileList as
$file) {
239 $cr[] = self::importDocument($file);
250 $tmpFile = tempnam(
getTmpDir() ,
"importData");
251 if ($tmpFile ===
false) {
252 throw new \Dcp\Exception(sprintf(
"Error creating temporary file in '%s'.",
getTmpDir()));
254 $ret = rename($tmpFile, $tmpFile .
'.csv');
255 if (
$ret ===
false) {
256 throw new \Dcp\Exception(sprintf(
"Error renaming '%s' to '%s'.", $tmpFile, $tmpFile .
'.csv'));
258 $tmpFile = $tmpFile .
'.csv';
259 $ret = file_put_contents($tmpFile,
$data);
260 if (
$ret ===
false) {
261 throw new \Dcp\Exception(sprintf(
"Error writing to file '%s'.", $tmpFile));
272 if (self::$include_path == null) {
273 self::$include_path = ini_get(
'include_path');
282 if (self::$include_path !== null) {
283 ini_set(
'include_path', self::$include_path);
298 if (
$value === $requiredValue) {
301 if ($markTestIncomplete ===
true) {
302 $this->markTestIncomplete(sprintf(
"Test requires %s '%s' (found '%s').", $paramName, $requiredValue,
$value));
310 private $value = null;
313 $this->value = $value;
318 return $this->resolve($this->value);
320 private function resolve($value)
323 if (is_numeric($id)) {
326 return (
string)$value;
static resetIncludePath()
static beginTransaction()
static connectUser($login="admin")
static $importCsvEnclosure
static importDocuments($fileList)
static importDocument($file)
if($path[0]== '/') $realfile
static setIncludePath($include_path)
static resetDocumentCache()
static setUpBeforeClass()
getParam($name, $def="")
must be in core or global type
WhatInitialisation($session=null)
getIdFromName($dbaccess, $name)
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
static $importCsvSeparator
if($file) if($subject==""&&$file) if($subject=="") $err
static rollbackTransaction()
requiresCoreParamEquals($paramName, $requiredValue, $markTestIncomplete=true)