Commit 1137964a by Frederick d. Maus

TestSystem: 3880 13m20s

1 parent 35e52e8e
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of class_mcPDOLogger
*
* @author Frederick <frederick at mensch.coop>
*/
class mcPDOLogger {
private static $Messages = array();
public static function add($param_order, array $param_bindValueArray=null, $param_optional='') {
mcPDOLogger::$Messages[] = array(
'order' => $param_order,
'bindValue' => $param_bindValueArray,
'optional' => $param_optional
);
}
public static function getMessagesAsText() {
$MessageAsText = '';
foreach(mcPDOLogger::$Messages as $message) {
$MessageAsText .= "\n".$message['order']."\n";
}
mcPDOLogger::$Messages = array();
return $MessageAsText;
}
}
?>
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="item" >
<xsd:complexType mixed="true">
<xsd:attribute name="key" use="required" type="xsd:string"/>
<xsd:attribute name="value" use="required" type="xsd:string"/>
<xsd:attribute name="label" use="required" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DBUIList" >
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element ref="item" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="count" use="required" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="Element_type">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="text"/>
<xsd:enumeration value="time"/>
<xsd:enumeration value="url"/>
<xsd:enumeration value="select"/>
<xsd:enumeration value="int"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="DBUIElement" >
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element ref="DBUIList" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="label" use="required" type="xsd:string"/>
<xsd:attribute name="objvar" use="required" type="xsd:string"/>
<xsd:attribute name="value" use="required" type="xsd:string"/>
<xsd:attribute name="type" type="Element_type" />
<xsd:attribute name="show" type="xsd:boolean"/>
<xsd:attribute name="edit" type="xsd:boolean"/>
<xsd:attribute name="fixed" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DBUIRow" >
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element ref="DBUIElement" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="i" use="required" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DBUIArray" >
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element ref="DBUIRow" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="count" use="required" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?php
/*
* Created on 27.02.2008
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
class Converter{
private static $Specials = array (
'&' => '',
'' => '',
'' => '',
'' => '',
'' => '',
'' => ''
);
/**
* Convert all HTML entities to their applicable characters for the Database
*
* @param string param_string
* @return string
*/
public static function decodeString($param_string){
// if(!is_array($param_string) && !is_object($param_string)) {
// $param_string = html_entity_decode($param_string, 1,"UTF-8");
// $param_string = addslashes($param_string);
// }
return $param_string;
}
/**
* Convert all applicable characters to HTML entities
*
* @param string param_string
* @return string
*/
public static function encodeString($param_string, $param_encode = true){
// $param_string = strip_tags($param_string);
// $param_string = htmlentities($param_string, 1,"UTF-8");
// $param_string = trim($param_string);
$param_string = stripslashes($param_string);
// D::show($param_string,"encode",1);
// if(!is_numeric($param_string)){
// $param_string = "'" . mysql_real_escape_string($param_string) . "'";
// }
if($param_encode){
return htmlspecialchars($param_string, 2,"UTF-8");
}
else{
return $param_string;
}
}
public static function StringToUrl($param_Url) {
return htmlentities($param_Url);
}
}
?>
\ No newline at end of file
<?php
class mcPUIX {
const DBUIConfig = 'DBUIConfig';
const PDOValues = 'PDOValues';
const PDOToSaveValues = 'PDOToSaveValues';
const DOMmcPUIX = 'mcPUIX';
const DOMRow = 'DBUIRow';
const DOMList = 'DBUIList';
const DOMElement = 'DBUIElement';
const DOMValues = 'DOMValues';
##
// DBUIArray evt überprüfen
const DBUIArray = 'DBUIArray';
// const FORMValues = 'DBUIFormValues'; mcPUIX::FORM_DO_ROW
const FORM_DO_ROW = 'FORM_DO_ROW'; // mcPUIX::FORM_DO_ROW
const FORM_DO_SAVE = 'FORM_DO_SAVE'; // mcPUIX::FORM_DO_SAVE
const FORM_DO_DELETE = 'FORM_DO_DELETE'; // mcPUIX::FORM_DO_DELETE
const FORM_DO_NEW = 'FORM_DO_NEW'; // mcPUIX::FORM_DO_NEW
const FORM_DO_SELECT = 'FORM_DO_SELECT'; // mcPUIX::FORM_DO_SELECT
const FORM_TYPE_SEOLINK = 'FORM_TYPE_SEOLINK';
const STATE_LOADED = 'loaded';
const STATE_CHANGED = 'changed';
const STATE_SAVED = 'saved';
private $DBTab_State = array();
/**
*
* @var array('tablename' => array(mcPUIX::DBUIArray => array()))
*/
private $DBTab = array();
/**
*
* @var aBasisElementAddon
*/
protected $BasisElementAddon = null;
public function __construct(aBasisElementAddon $BasisElementAddon) {
$this->BasisElementAddon = $BasisElementAddon;
}
private function setTableValues($param_tablename, $param_tablevalues) {
$this->DBTab[$param_tablename] = $param_tablevalues;
}
public function getTableValues($param_tablename) {
return $this->DBTab[$param_tablename];
}
public function loadPDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_tablename, $param_SQLWhere='', $param_depth=0) {
$DBTable = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $param_tablename, $param_SQLWhere, $param_depth);
// D::show($DBTable, '$DBTable '.$this->BasisElementAddon);
$this->setTableValues($param_tablename, $DBTable);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_LOADED;
}
public function setData($param_tablename, $param_values) {
D::ulli(__CLASS__.'::'.__FUNCTION__.': ' . $param_tablename.' ## '.mcPUIX::STATE_CHANGED);
$this->setTableValues($param_tablename, $param_values);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_CHANGED;
}
public function savePDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_tablename) {
$DBUIArray_Values = $this->getTableValues($param_tablename);
// D::show($this->DBTab , '$this->DBTab');
$ManipulateTableConfig = null;
$DBUIConfig = mcPUIX_CONFIG::getTableConfig($param_tablename, $ManipulateTableConfig);
// D::show($DBUIConfig, '$DBUIConfig');
if(mcArray::checkKeyHasFullArray($DBUIConfig, mcPUIX::DBUIArray, mcPUIX::DBUIConfig, $param_tablename, 'TABLE', 'LIST_TABLE', 'TABLENAME')) {
$Tablename_LIST = mcPUIX_CONFIG::getReferenceTableName($param_tablename);
$ManipulateTableConfig = null;
$DBUIConfig_LIST = mcPUIX_CONFIG::getTableConfig($Tablename_LIST, $ManipulateTableConfig);
$DBUIConfig[mcPUIX::DBUIArray][mcPUIX::DBUIConfig][$Tablename_LIST] = $DBUIConfig_LIST[mcPUIX::DBUIArray][mcPUIX::DBUIConfig][$Tablename_LIST];
}
$PreparedArray = mcPUIX_PDO::prepareArrayForDBOperation($param_tablename, $DBUIConfig, $DBUIArray_Values);
// D::show($PreparedArray, '$PreparedArray = mcPUIX_PDO::prepareArrayForDBOperation');
$DBUIArrayNew = mcPUIX_PDO::updateDatabaseTable($param_HostAccount, $param_iStorable, $DBUIConfig, $PreparedArray);
$this->setTableValues($param_tablename, $DBUIArrayNew);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_SAVED;
}
public function getObjDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_KindOf=null, array $param_DOMElemente=null) {
$DOMElement = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX);
$DOMElement->setAttribute('class', get_class($this));
$DOMElement->setAttribute('label', Language::getWord(get_class($this)));
if($param_KindOf=='form') {
$DOMElement->setAttribute('edit', true);
}
return $DOMElement;
}
protected static $unsetCONFIG = true;
public static function setmcPUIX_CONFIG() {
if(Category2mcPUIX::$unsetCONFIG) {
foreach(Category2mcPUIX::$Tables as $tablename => $values) {
mcPUIX_CONFIG::setTableConfig($tablename, $values);
}
Category2mcPUIX::$unsetCONFIG = false;
}
}
protected static $Tables = array ();
}
?>
<?php
class mcPUIX_CONFIG {
//'KINDOF' => 'DATASET',
protected static $Tables = array();
public static function setTableConfig($param_tablename, array $param_TableValues) {
mcPUIX_CONFIG::$Tables[$param_tablename] = $param_TableValues;
}
/**
* return the table config
*
* @param string $param_tablename
* @param array $param_ManipulateTableConfig
* @return array( mcPUIX::DBUIArray => array( mcPUIX::DBUIConfig => array( $param_tablename => array()) ) ) || FALSE
*/
public static function getTableConfig($param_tablename, array $param_ManipulateTableConfig=null) {
if(array_key_exists($param_tablename, mcPUIX_CONFIG::$Tables) && is_array(mcPUIX_CONFIG::$Tables[$param_tablename])) {
$Config = mcPUIX_CONFIG::$Tables[$param_tablename];
if(is_array($param_ManipulateTableConfig)) {
if(!array_key_exists('TABLE', $Config) || !is_array($Config['TABLE'])) {
$Config['TABLE'] = array();
}
foreach($param_ManipulateTableConfig as $key => $value) {
$Config['TABLE'][$key] = $value;
}
}
$result = array(
mcPUIX::DBUIArray => array( mcPUIX::DBUIConfig => array( $param_tablename => $Config) )
);
return $result;
} else {
return false;
}
}
public static function getReferenceTableName($param_tablename) {
if(mcArray::checkKeyHasFullArray(mcPUIX_CONFIG::$Tables[$param_tablename], 'TABLE', 'LIST_TABLE')) {
if(mcPUIX_CONFIG::$Tables[$param_tablename]['TABLE']['LIST_TABLE']['TABLENAME']) {
$Tablename_LIST = mcPUIX_CONFIG::$Tables[$param_tablename]['TABLE']['LIST_TABLE']['TABLENAME'];
} else {
return false;
}
} else {
return false;
}
return $Tablename_LIST;
}
}
?>
\ No newline at end of file
<?php
require_once 'basepath.inc.php';
require_once $__BASEPATH_EX.'include/config.php';
/**
* Language
*/
require_once $__BASEPATH_EX.'include/Forest/mensch.coop/php/class_Language.mensch.coop.inc.php';
require_once $__BASEPATH_EX.'include/System/php/class_Language.inc.php';
require_once $__BASEPATH_EX.'include/System/php/class_CONSTKindOf.inc.php';
/**
* Converter
*/
require_once $__BASEPATH_EX . 'include/Lib/Tools/mcClasses/mcPUIX/class_Converter.inc.php';
require_once $__BASEPATH_EX.'include/Lib/Tools/mcClasses/mcPUIX/class_mcPUIX_DOM.inc.php';
$_PHPUNIT_mcPUIX_DOMTest_XSD = $__BASEPATH_EX . 'include/Lib/Tools/mcClasses/mcPUIX/Element.xsd';
$_PHPUNIT_mcPUIX_DOMTest_XSL = $__BASEPATH_EX . 'include/Lib/Tools/mcClasses/mcPUIX/mcPUIX.xsl';
/**
* Test class for mcPUIX_DOM.
* Generated by PHPUnit on 2010-07-13 at 14:12:14.
*/
class mcPUIX_DOMTest extends PHPUnit_Framework_TestCase {
protected $stylesheet;
protected $processor;
protected function setUp() {
global $_PHPUNIT_mcPUIX_DOMTest_XSL;
$this->stylesheet = new DOMDocument;
$this->stylesheet->load($_PHPUNIT_mcPUIX_DOMTest_XSL);
$this->processor = new XSLTProcessor;
$this->processor->importStylesheet($this->stylesheet);
}
protected function tearDown() {
}
private function checkXML(DOMDocument $param_DOMDocument) {
$DOMHtml = new DOMDocument;
$this->assertTrue($DOMHtml->loadHTML($this->processor->transformToDoc($param_DOMDocument)->saveXML()), 'validate DOMElement with xsd');
return $DOMHtml;
}
private function checkXMLString(DOMDocument $param_DOMDocument, array $param_SearchStringArray, $param_SearchStringDirection=false) {
$this->checkXML($param_DOMDocument);
$HTMLString = $this->processor->transformToDoc($param_DOMDocument)->saveXML();
foreach($param_SearchStringArray as $TagName) {
$this->assertTrue(substr_count($HTMLString, $TagName)>0, 'found string('.$TagName.')');
// $this->assertTrue(substr_count($HTMLString, $TagName.'l')>0, 'found string('.$TagName.')');
if($param_SearchStringDirection) {
$HTMLString = strstr($HTMLString, $TagName);
}
}
return $HTMLString;
}
private function checkGetDOMElement_Element(array $param_OptionalAttributes=array(), array $param_SearchStringArray=array()) {
global $_LOSP_CHARSET;
global $_PHPUNIT_mcPUIX_DOMTest_XSD;
$DOMDocument = new DOMDocument('1.0', $_LOSP_CHARSET);
$DOMDocument->appendChild(mcPUIX_DOM::getDOMElement_Element($DOMDocument, 'objvar', $param_OptionalAttributes));
echo "\n".$DOMDocument->saveXML()."\n";
$this->assertTrue($DOMDocument->schemaValidate($_PHPUNIT_mcPUIX_DOMTest_XSD), 'validate DOMElement with xsd');
$this->checkXMLString($DOMDocument, $param_SearchStringArray, true);
}
private function checkGetDOMElement_DBUIArray(array $param_Array, array $param_SearchStringArray=array()) {
global $_LOSP_CHARSET;
global $_PHPUNIT_mcPUIX_DOMTest_XSD;
$DOMDocument = new DOMDocument('1.0', $_LOSP_CHARSET);
$DOMDocument->appendChild(mcPUIX_DOM::getDOMElement_DBUIArray($DOMDocument, $param_Array));
$this->assertTrue($DOMDocument->schemaValidate($_PHPUNIT_mcPUIX_DOMTest_XSD), 'validate DOMElement with xsd');
}
public function testGetDOMElement_Element() {
/**
* test default
*/
// $this->checkGetDOMElement_Element();
/**
* test as text
*/
$var_OptionalAttributes = array(
'type' => 'text',
'show' => true,
'edit' => true
);
$this->checkGetDOMElement_Element($var_OptionalAttributes, array('textarea'));
/**
* teset as select
*/
$var_OptionalAttributes = array(
'type' => 'select',
'show' => true,
'edit' => true,
'value' => '1',
'values' => array('1' => 'eins', '2' => 'zwei')
);
// $this->checkGetDOMElement_Element($var_OptionalAttributes, array('select', 'option'));
}
public function testGetDOMElement_DBUIArray() {
$array = array(
array(
'INT' => array('type'=> 'int', 'show'=> true, 'value' => 1),
'KEY' => array('show'=> true, 'value' => 'key'),
'TEXT' => array('type'=> 'text', 'show'=> true, 'value' => 1, 'edit' => true),
'SELECT'=> array('type'=> 'select', 'show'=> true, 'value' => '', 'values' => array('select1', 'select2'), 'edit' => true),
),
array(
'ID' => array('type'=> 'int', 'show'=> true, 'value' => 1),
'Key' => array('show'=> true, 'value' => 'key'),
'value' => array('type'=> 'text', 'show'=> true, 'value' => 1),
'select'=> array('type'=> 'select', 'show'=> true, 'values' => array('select1', 'select2')),
),
array(
'ID' => array('type'=>'int', 'show'=> true, 'value' => 1),
'Key' => array('show'=>true, 'value'=>'key'),
'value' => array('type'=>'text', 'show'=>true, 'value'=>1, 'edit'=>true, 'fixed'=>true),
'select'=> array('type'=>'select', 'show'=> true, 'values' => array('select1', 'select2'), 'value' => 1),
)
);
// $this->checkGetDOMElement_DBUIArray($array, array('<option value="1" selected="selected">', '</textarea>', '</select>', '</option>'));
}
}
?>
\ No newline at end of file
<?php
require_once 'PHPUnit/Framework.php';
require_once dirname(__FILE__) . '/../../../../../../include/Lib/Tools/mcClasses/mcPUIX/class_mcPUIX_PDO.inc.php';
/**
* Test class for mcPUIX_PDO.
* Generated by PHPUnit on 2010-07-13 at 14:12:11.
*/
class mcPUIX_PDOTest extends PHPUnit_Framework_TestCase {
/**
* @var mcPUIX_PDO
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new mcPUIX_PDO;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {
}
}
?>
\ No newline at end of file
<?php
//require_once 'PHPUnit/Framework.php';
require_once 'basepath.inc.php';
require_once $__BASEPATH_EX . 'include/config.php';
require_once $__BASEPATH_EX . 'include/Lib/Tools/mcClasses/mcPUIX/class_mcPUIX_PHP.inc.php';
/**
* Test class for mcPUIX_PHP.
* Generated by PHPUnit on 2010-07-13 at 14:12:12.
*/
class mcPUIX_PHPTest extends PHPUnit_Framework_TestCase {
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {
}
public function testPrepareArrayForDOMElement() {
$ValueArray = array(
mcPUIX::DBUIArray => array(
array( 'key1' => 'value11',
'key2' => 'value12',
'key3' => 'value13',
'key4' => 'value14',
),
array( 'key1' => 'value21',
'key2' => 'value22',
'key3' => 'value23',
'key4' => 'value24',
),
)
);
$ConfigArray = array(
'key1' => array('edit'=>true, 'show'=>true, 'type'=>'text'),
'key2' => array('edit'=>true, 'show'=>false, 'type'=>'text'),
'key3' => array('edit'=>true, 'show'=>true, 'type'=>'text'),
'key4' => array('edit'=>false, 'show'=>true, 'type'=>'text'),
);
/**
* default case
*/
$result = mcPUIX_DOM::prepareArrayForDOMElement($ConfigArray, $ValueArray);
$HaveToResult = array(
array(
'key1' => array('edit'=>true, 'show'=>true, 'type'=>'text', 'value'=>'value11'),
'key2' => array('edit'=>true, 'show'=>false, 'type'=>'text', 'value'=>'value12'),
'key3' => array('edit'=>true, 'show'=>true, 'type'=>'text', 'value'=>'value13'),
'key4' => array('edit'=>false, 'show'=>true, 'type'=>'text', 'value'=>'value14'),
),
array(
'key1' => array('edit'=>true, 'show'=>true, 'type'=>'text', 'value'=>'value21'),
'key2' => array('edit'=>true, 'show'=>false, 'type'=>'text', 'value'=>'value22'),
'key3' => array('edit'=>true, 'show'=>true, 'type'=>'text', 'value'=>'value23'),
'key4' => array('edit'=>false, 'show'=>true, 'type'=>'text', 'value'=>'value24'),
),
);
$this->checkArrayDiff($result, $HaveToResult);
/**
* case but more $param_ConfigArray then $param_ValueArray
*/
$ConfigArray['key5'] = array('edit'=>false, 'show'=>true, 'type'=>'checkbox');
$HaveToResult[0]['key5']= array('edit'=>false, 'show'=>true, 'type'=>'checkbox');
$HaveToResult[1]['key5']= array('edit'=>false, 'show'=>true, 'type'=>'checkbox');
$result = mcPUIX_DOM::prepareArrayForDOMElement($ConfigArray,$ValueArray);
$this->checkArrayDiff($result, $HaveToResult);
unset($ConfigArray['key5']);
unset($HaveToResult[0]['key5']);
unset($HaveToResult[1]['key5']);
/**
* default case with $param_SetDefault
*/
$SetDefault = array(
'*' => array('type' => 'checkbox',)
);
$result = mcPUIX_DOM::prepareArrayForDOMElement($ConfigArray, $ValueArray, $SetDefault);
$HaveToResult = array(
array(
'key1' => array('edit'=>true, 'show'=>true, 'type'=>'checkbox', 'value'=>'value11'),
'key2' => array('edit'=>true, 'show'=>false, 'type'=>'checkbox', 'value'=>'value12'),
'key3' => array('edit'=>true, 'show'=>true, 'type'=>'checkbox', 'value'=>'value13'),
'key4' => array('edit'=>false, 'show'=>true, 'type'=>'checkbox', 'value'=>'value14'),
),
array(
'key1' => array('edit'=>true, 'show'=>true, 'type'=>'checkbox', 'value'=>'value21'),
'key2' => array('edit'=>true, 'show'=>false, 'type'=>'checkbox', 'value'=>'value22'),
'key3' => array('edit'=>true, 'show'=>true, 'type'=>'checkbox', 'value'=>'value23'),
'key4' => array('edit'=>false, 'show'=>true, 'type'=>'checkbox', 'value'=>'value24'),
),
);
$this->checkArrayDiff($result, $HaveToResult);
}
public function testPrepareArrayForDBOperation() {
$ConfigArray = array(
'TABLE' => array(
'PRIMARY' => array('Primary1ID', 'Primary2ID'),
'REQUIRED' => array('Required1', 'Required2'),
),
mcPUIX::FORM_DO_ROW => array(),
'Key1' => array(),
'Key2' => array(),
);
/**
* nothing new
*/
$NewArray = array();
$result = mcPUIX_PDO::prepareArrayForDBOperation($ConfigArray, $NewArray);
$HaveToResult = array(
'UpdateRows' => array(
),
'DeleteRows' => array(
),
'ErrorRows' => array(
),
'NewRows' => array(
),
);
$this->checkArrayDiff($result, $HaveToResult);
/**
*
*/
$NewArray = array(
// UpdateRows
0 => array(
mcPUIX::FORM_DO_ROW => 1,
'Key1' => 'value',
'Key2' => '',
'Primary1ID' => 1,
'Primary2ID' => 2,
'Required1' => 'require',
'Required2' => 'require',
),
// DeleteRows
1 => array(
mcPUIX::FORM_DO_ROW => false, // !!!
'Key1' => 'value',
'Key2' => '',
'Primary1ID' => 1,
'Primary2ID' => 2,
'Required1' => 'require',
'Required2' => 'require',
),
// ErrorRows
2 => array(
mcPUIX::FORM_DO_ROW => 1,
'Key1' => 'value',
'Key2' => '',
'Primary1ID' => 1,
'Primary2ID' => 2,
'Required1' => 'require',
'Required2' => false, // !!!
),
// NewRows
3 => array(
mcPUIX::FORM_DO_ROW => 1,
'Key1' => 'value',
'Key2' => '',
'Primary1ID' => 0, // !!!
'Primary2ID' => 0, // !!!
'Required1' => 'require',
'Required2' => 'require',
),
);
$result = mcPUIX_PDO::prepareArrayForDBOperation($ConfigArray, $NewArray);
$HaveToResult = array(
'UpdateRows' => array(
$NewArray[0]
),
'DeleteRows' => array(
$NewArray[1]
),
'ErrorRows' => array(
$NewArray[2]
),
'NewRows' => array(
$NewArray[3]
),
);
$this->checkArrayDiff($result, $HaveToResult);
}
/**
* check arrays rekursiv until the 3. level
*
* @param array $param_array1
* @param array $param_array2
*/
private function checkArrayDiff(array $param_array1, array $param_array2) {
$diff = array_diff_assoc ($param_array1, $param_array2);
$this->assertTrue(empty($diff), 'validate DOMElement with xsd');
foreach($param_array1 as $key_1 => $value_1) {
$diff_1 = array_diff_assoc ($value_1, $param_array2[$key_1]);
$this->assertTrue(empty($diff_1), 'validate DOMElement with xsd');
$this->assertTrue((count($value_1) == count($param_array2[$key_1])), 'count');
foreach($value_1 as $key_2 => $value_2 ) {
$diff_2 = array_diff_assoc ($value_2, $param_array2[$key_1][$key_2]);
$this->assertTrue(empty($diff_2), 'validate DOMElement with xsd');
$this->assertTrue(count($value_2) == count($param_array2[$key_1][$key_2]), 'count');
}
}
}
}
?>
\ No newline at end of file
<?php
/**
* @var link to the basic path from the basic dir
*/
$__BASEPATH_EX= '../../../../../';
/**
* only important for when you inclue 'include/Lib/Tools/mcClasses/include.php,
* in the moment this makes RequireClass.inc.php
*/
$__PATH_to_mcClasses= $__BASEPATH_EX .'include/Lib/Tools/mcClasses/';
?>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!