<?php

	/**
	 * Modul um die Shop Funktionen zu testen
	 * @author daniel
	 */
	class wpsg_mod_test extends wpsg_mod_basic
	{
		
		var $id = 14;
		var $arKeyLabel = array();
		var $arOriginalConfig = array();
		var $_arTableBackup = array(); 
		
		/**
		 * Costructor
		 */
		public function __construct()
		{
			
			parent::__construct();
			
			// Array mit den Bezeichnungen für die Keys, damit ich die nicht immer tippen muss
			$this->arKeyLabel = array(
				'sum/mwst' => 'Summe Mehrwertsteuer',
				'sum/preis_netto' => 'Summe Nettopreis vor Versand/Zahlung',
				'sum/preis_brutto' => 'Summe Bruttopreis vor Versand/Zahlung',
				'sum/preis' => 'Angezeigter Preis vor Versand/Zahlung',
				'sum/preis_gesamt_netto' => 'Summe Nettopreis nach Versand/Zahlung',
				'sum/preis_gesamt_brutto' => 'Summe Bruttopreis nach Versand/Zahlung',
				'sum/preis_gesamt' => 'Angezeigter Preis nach Versand/Zahlung',
				'sum/gs_netto' => 'Gutscheinwert Netto',
				'sum/gs_brutto' => 'Gutscheinwert Brutto',
				'sum/gs' => 'Angezeigter Gutscheinwert',				
				'mwst/c_1/base_value' => 'Bruttobezug für 19%',
				'mwst/c_1/sum' => 'Mehrwertsteuer 19%',
				'mwst/b_1/base_value' => 'Bruttobezug für 7%',
				'mwst/b_1/sum' => 'Mehrwertsteuer 7%'
			);
						
			$this->name = __('Test', 'wpsg');
			$this->group = __('Sonstiges', 'wpsg');
			$this->desc = __('', 'wpsg');
						
		} // public function __construct()
		
		public function settings_edit()
		{

			$this->shop->view['arKeyLabel'] = $this->arKeyLabel;
			  
			$this->saveConfig();
						
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '1',
				'cdate' => 'NOW()',
				'name' => 'Produkt 7%',
				'preis' => '107.00', 
				'mwst_key' => 'b'									
			));
			
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '2',
				'cdate' => 'NOW()',
				'name' => 'Produkt 19',
				'preis' => '119.00', 
				'mwst_key' => 'c'
			));
						
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '3',
				'cdate' => 'NOW()',
				'name' => 'Produkt 5',
				'preis' => '3', 	
				'mwst_key' => 'a'
			));
			
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '4',
				'cdate' => 'NOW()',
				'name' => 'Produkt 19 (Netto definiert)',
				'preis' => '100.00',
				'mwst_key' => 'c'
			));
			
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '5',
				'cdate' => 'NOW()',
				'name' => 'Produkt 19',
				'preis' => '119.00', 
				'mwst_key' => 'c',
				'euleistungsortregel' => '1'
			));
			
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '6',
				'cdate' => 'NOW()',
				'name' => 'Variantenprodukt 19',
				'preis' => '0.00',
				'mwst_key' => 'c',
				'euleistungsortregel' => '1',
				'mod_varianten' => 'a:1:{i:0;a:5:{s:4:"name";s:6:"Lizenz";s:3:"typ";s:5:"radio";s:5:"aktiv";s:1:"1";s:4:"vari";a:3:{i:0;a:6:{s:4:"name";s:5:"Light";s:5:"preis";s:5:"25.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:43:",Untitled-1.jpg,Box_wpShopGermany_Light.jpg";}i:1;a:6:{s:4:"name";s:3:"Pro";s:5:"preis";s:5:"45.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:41:",Untitled-1.jpg,Box_wpShopGermany_Pro.jpg";}i:2;a:6:{s:4:"name";s:10:"Enterprise";s:5:"preis";s:6:"149.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:48:",Untitled-1.jpg,Box_wpShopGermany_Enterprise.jpg";}}s:4:"lang";a:0:{}}}'					
			));
			
			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
				'id' => '7',
				'cdate' => 'NOW()',
				'name' => 'Rabattprodukt',
				'rabatt' => '1_01.01.2000_01.01.2020_24.98%',
				'preis' => '20.00',
				'mwst_key' => 'a',
				'euleistungsortregel' => '0',
				'mod_varianten' => '',
				'basket_multiple' => '2'
			));
			
			$this->db->ImportQuery(WPSG_TBL_VA, array(
				'id' => '1',
				'vz' => '0', 
				'mwst_laender' => '0',
				'mwst_key' => '0',
				'typ' => 'w',
				'kosten' => '4',
				'aktiv' => '1'					
			));
			
			$this->db->ImportQuery(WPSG_TBL_LAND, array(
				'id' => '1',
				'name' => 'Deutschland',
				'kuerzel' => 'DE',
				'vz' => '1',
				'mwst' => '0',
				'mwst_c' => '19',
				'mwst_b' => '7'
			));
			
			$this->db->ImportQuery(WPSG_TBL_LAND, array(
				'id' => '2',
				'name' => 'Österreich',
				'kuerzel' => 'AT',
				'vz' => '1',
				'mwst' => '2', // Keine MwSt. bei USt.IdNr.
				'mwst_a' => '',
				'mwst_b' => '10',
				'mwst_c' => '20',
				'mwst_d' => '12'
			));
			
			$this->db->ImportQuery(WPSG_TBL_LAND, array(
				'id' => '3',
				'name' => 'Schweiz',
				'kuerzel' => 'CH',
				'vz' => '2',
				'mwst' => '1', // Keine MwSt.
				'mwst_c' => '',
				'mwst_b' => ''
			));
			
			$this->shop->update_option('wpsg_defaultland', '1');
			
			wp_cache_flush();
			
			$this->shop->wp_load();
   						 			
			if ($this->shop->hasMod('wpsg_mod_gutschein'))
			{
			
				$this->test2(WPSG_BRUTTO, WPSG_BRUTTO); 
				$this->test2(WPSG_BRUTTO, WPSG_NETTO);
				$this->test2(WPSG_NETTO, WPSG_BRUTTO);
				$this->test2(WPSG_NETTO, WPSG_NETTO);
				
				$this->test3(WPSG_BRUTTO, WPSG_BRUTTO);
				$this->test3(WPSG_BRUTTO, WPSG_NETTO);
				$this->test3(WPSG_NETTO, WPSG_BRUTTO);
				$this->test3(WPSG_NETTO, WPSG_NETTO);
				
				$this->test4(WPSG_BRUTTO, WPSG_BRUTTO);
				$this->test4(WPSG_BRUTTO, WPSG_NETTO);
				$this->test4(WPSG_NETTO, WPSG_BRUTTO);
				$this->test4(WPSG_NETTO, WPSG_NETTO);
				
				$this->test5();
				$this->test6();
				
				if ($this->shop->hasMod('wpsg_mod_discount'))
				{
				
					$this->test7();
					
				}
			
				if ($this->shop->hasMod('wpsg_mod_gutschein'))
				{
					
					$this->test8();
					
				}
				
			}

			$this->test9();
			
			$this->test10();
			$this->test11();
			$this->test11(true);
			$this->test12();
			$this->test13();
			$this->test14();
			$this->test15();
			$this->test16();
			$this->test17();
			$this->test18();
						 						
			$this->restoreConfig();
			 									
			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_test/settings_edit.phtml');
			
		} // public function settings_edit()
		
		/* Tests */
		
		/**
		 * Setzt die Konfiguration zurück für einen neuen Test
		 */
		private function resetConfig()
		{
			
			$_SESSION['wpsg'] = array();
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_debugModus', '1');
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);			
			$this->shop->update_option('wpsg_kleinunternehmer', false);
			$this->shop->update_option('wpsg_mod_discount_data', array());
			
			$time = time();
			
			$this->shop->update_option('wpsg_mod_varianten', $time);
			$this->shop->update_option('wpsg_mod_gutschein', $time);
			$this->shop->update_option('wpsg_mod_versandarten', $time);
			
			$this->shop->update_option('wpsg_module', base64_encode(serialize(array(
				'wpsg_mod_varianten' => $time,
				'wpsg_mod_gutschein' => $time,
				'wpsg_mod_versandarten' => $time					
			))));
			
			wp_cache_flush();
			
		} // private function resetConfig()
		
		/**
		 * Speichert die Einstellungen vor den Tests
		 */
		public function saveConfig()
		{
			
			$this->arOriginalConfig = array(
				'wpsg_preisangaben' => $this->shop->get_option('wpsg_preisangaben'),
				'wpsg_preisangaben_frontend' => $this->shop->getFrontendTaxview(),
				'wpsg_kleinunternehmer' => $this->shop->get_option('wpsg_kleinunternehmer'),
				'wpsg_mod_discount_data' => $this->shop->get_option('wpsg_mod_discount_data')
			);
			
			$this->arOriginalConfig = $this->db->fetchAssoc("SELECT * FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");
			
			$this->db->Query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");			
			wp_cache_delete('alloptions', 'options');
									
			// Tabllen speichern
			$arTables = $this->db->fetchAssocField("SHOW TABLES");
			
			foreach ($arTables as $table_name)
			{
				 
				if (preg_match('/wpsg\_(.*)/', $table_name))
				{
					
					$this->_arTableBackup[$table_name] = $this->db->fetchAssoc("SELECT * FROM `".wpsg_q($table_name)."`");
															
				}
				
			}
			
			// Backup ist erstellt, jetzt die Tabellen leeren von denen ein Backup erstellt wurde
			foreach ($this->_arTableBackup as $table_name => $table_data)
			{
		 
				$this->db->Query("TRUNCATE TABLE `".wpsg_q($table_name)."` ");
				
			}
			
		} // public function saveConfig()
		
		/**
		 * Stellt die Einstellungen nach den Tests wieder her
		 */
		public function restoreConfig()
		{
 
			$this->db->Query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");
			
			foreach ($this->arOriginalConfig as $k => $v)
			{
				 				
				unset($v['option_id']);
				$this->db->ImportQuery('wp_options', $v);
								
			}
			 
			wp_cache_delete('alloptions', 'options');
			 
			foreach ($this->_arTableBackup as $table_name => $table_data)
			{
				
				$this->db->Query("TRUNCATE TABLE `".wpsg_q($table_name)."` ");
				
				foreach ($table_data as $row)
				{
					
					$this->db->ImportQuery($table_name, wpsg_q($row));
					
				}
								
			}
			
			unset($_SESSION['wpsg']);
						
		} // public function restoreConfig()
		
		/**
		 * Testfall 1
		 *
		 * 1 Produkt 19%/119€Brutto 
		 * 1 Produkt 7%/107€Brutto
		 * - Keine Versandarten
		 * - Kein Gutschein
		 * - Kein Rabatt
		 */
		private function test1()
		{
			
			$this->resetConfig();
			 
			$_SESSION['wpsg']['basket'] = array(
				0 => array(
					'menge' => 1,
					'id' => 1
				),
				1 => array(
					'menge' => 1,
					'id' => 2
				)
			);
						
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			 
			$this->shop->view['test'][] = array(
				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto',
				'tests' => array(
					'sum/mwst' => array(false, 26),
					'sum/preis_netto' => array(false, 200),
					'sum/preis_brutto' => array(false, 226),
					'sum/preis' => array(false, 226),					
					'sum/preis_gesamt_netto' => array(false, 200),
					'sum/preis_gesamt_brutto' => array(false, 226),
					'sum/preis_gesamt' => array(false, 226),
					'mwst/b_1/base_value' => array(false, 107),
					'mwst/b_1/sum' => array(false, 7),
					'mwst/c_1/base_value' => array(false, 119),
					'mwst/c_1/sum' => array(false, 19),
				),
				'array' => $basket->toArray(),
				'config' => $this->showConfiguration()
			);
						 
		} // private function test1()
		
		/**
		 * Testfall 2
		 * 
		 * 1 Produkt 19%/119€Brutto
		 * - Keine Versandarten
		 * - 1 Gutschein Wert 10Euro
		 * - Kein Rabatt
		 */
		private function test2($preisangabe_backend, $preisangabe_frontend)
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 2
					)
				),
				'gs' => array(
					'value' => 10,
					'calc' => 'w',
					'code' => 'Abs10',
					'id' => 1
				)
			);

			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Brutto - Brutto',
					'tests' => array(
						'sum/mwst' => array(false, 17.403361344538),
						'sum/preis_netto' => array(false, 91.596638655462),
						'sum/preis_brutto' => array(false, 109),
						'sum/preis' => array(false, 109),		
						'sum/preis_gesamt_netto' => array(false, 91.596638655462),
						'sum/preis_gesamt_brutto' => array(false, 109),
						'sum/preis_gesamt' => array(false, 109),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Brutto - Netto',
					'tests' => array(
						'sum/mwst' => array(false, 17.403361344538),						
						'sum/preis_netto' => array(false, 91.596638655462),
						'sum/preis_brutto' => array(false, 109),
						'sum/preis' => array(false, 91.596638655462),						
						'sum/preis_gesamt_netto' => array(false, 91.596638655462),
						'sum/preis_gesamt_brutto' => array(false, 109),
						'sum/preis_gesamt' => array(false, 91.596638655462),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Netto - Brutto',
					'tests' => array(
						'sum/mwst' => array(false, 20.71),						
						'sum/preis_netto' => array(false, 109),
						'sum/preis_brutto' => array(false, 129.71),
						'sum/preis' => array(false, 129.71),						
						'sum/preis_gesamt_netto' => array(false, 109),
						'sum/preis_gesamt_brutto' => array(false, 129.71),
						'sum/preis_gesamt' => array(false, 129.71),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Netto - Netto',
					'tests' => array(
						'sum/mwst' => array(false, 20.71),						
						'sum/preis_netto' => array(false, 109),
						'sum/preis_brutto' => array(false, 129.71),
						'sum/preis' => array(false, 109),						
						'sum/preis_gesamt_netto' => array(false, 109),
						'sum/preis_gesamt_brutto' => array(false, 129.71),
						'sum/preis_gesamt' => array(false, 109),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			
		} // private function test2()
		 		
		/**
		 * Wie test2 nur mit zwei Produkten
		 */
		private function test3($preisangabe_backend, $preisangabe_frontend)
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 2
					),
					1 => array(
						'menge' => 1,
						'id' => 1
					)
				),
				'gs' => array(
					'value' => 10,
					'calc' => 'w',
					'code' => 'Abs10',
					'id' => 1
				)
			);

			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '2 Produkte (119€/19% und 107€/7%) mit Gutschein (10€) / Brutto - Brutto',
					'tests' => array(
						'sum/mwst' => array(false, 24.849557522124),
						'sum/preis_netto' => array(false, 191.15044247788),
						'sum/preis_brutto' => array(false, 216),
						'sum/preis' => array(false, 216),		
						'sum/preis_gesamt_netto' => array(false, 191.15044247788),
						'sum/preis_gesamt_brutto' => array(false, 216),
						'sum/preis_gesamt' => array(false, 216),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '2 Produkte (119€/19% und 107€/7%) mit Gutschein (10€) / Brutto - Netto',
					'tests' => array(
						'sum/mwst' => array(false, 24.849557522124),
						'sum/preis_netto' => array(false, 191.15044247788),
						'sum/preis_brutto' => array(false, 216),
						'sum/preis' => array(false, 191.15044247788),		
						'sum/preis_gesamt_netto' => array(false, 191.15044247788),
						'sum/preis_gesamt_brutto' => array(false, 216),
						'sum/preis_gesamt' => array(false, 191.15044247788),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '2 Produkte (119€/19% und 107€/7%) mit Gutschein (10€) / Netto - Brutto',
					'tests' => array(
						'sum/mwst' => array(false, 28.736462319406),
						'sum/preis_netto' => array(false, 216),
						'sum/preis_brutto' => array(false, 244.73646231941),
						'sum/preis' => array(false, 244.73646231941),		
						'sum/preis_gesamt_netto' => array(false, 216),
						'sum/preis_gesamt_brutto' => array(false, 244.73646231941),
						'sum/preis_gesamt' => array(false, 244.73646231941),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '2 Produkte (119€/19% und 107€/7%) mit Gutschein (10€) / Netto - Netto',
					'tests' => array(
						'sum/mwst' => array(false, 28.736462319406),						
						'sum/preis_netto' => array(false, 216),
						'sum/preis_brutto' => array(false, 244.73646231941),
						'sum/preis' => array(false, 216),						
						'sum/preis_gesamt_netto' => array(false, 216),
						'sum/preis_gesamt_brutto' => array(false, 244.73646231941),
						'sum/preis_gesamt' => array(false, 216),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			
		} // private function test3()

		/**
		 * Testfall 4
		 * 
		 * 1 Produkt 19%/119€Brutto
		 * - Keine Versandarten
		 * - 1 Gutschein Wert 10%
		 * - Kein Rabatt
		 */
		private function test4($preisangabe_backend, $preisangabe_frontend)
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 2
					)
				),
				'gs' => array(
					'value' => 10,
					'calc' => 'p',
					'code' => 'Proz10',
					'id' => 2
				)
			);

			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10%) / Brutto - Brutto',
					'tests' => array(
						'sum/mwst' => array(false, 17.1),
						'sum/preis_netto' => array(false, 90),
						'sum/preis_brutto' => array(false, 107.1),
						'sum/preis' => array(false, 107.1),		
						'sum/preis_gesamt_netto' => array(false, 90),
						'sum/preis_gesamt_brutto' => array(false, 107.1),
						'sum/preis_gesamt' => array(false, 107.1),						
						'sum/gs_netto' => array(false, 10),
						'sum/gs_brutto' => array(false, 11.9),
						'sum/gs' => array(false, 11.9)
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Brutto - Netto',
					'tests' => array(
						'sum/mwst' => array(false, 17.1),						
						'sum/preis_netto' => array(false, 90),
						'sum/preis_brutto' => array(false, 107.1),
						'sum/preis' => array(false, 90),						
						'sum/preis_gesamt_netto' => array(false, 90),
						'sum/preis_gesamt_brutto' => array(false, 107.1),
						'sum/preis_gesamt' => array(false, 90),
						'sum/gs_netto' => array(false, 10),
						'sum/gs_brutto' => array(false, 11.9),
						'sum/gs' => array(false, 10)
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Netto - Brutto',
					'tests' => array(
						'sum/mwst' => array(false, 20.349),						
						'sum/preis_netto' => array(false, 107.1),
						'sum/preis_brutto' => array(false, 127.449),
						'sum/preis' => array(false, 127.449),						
						'sum/preis_gesamt_netto' => array(false, 107.1),
						'sum/preis_gesamt_brutto' => array(false, 127.449),
						'sum/preis_gesamt' => array(false, 127.449),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
			{
				
				$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Netto - Netto',
					'tests' => array(
						'sum/mwst' => array(false, 20.349),						
						'sum/preis_netto' => array(false, 107.1),
						'sum/preis_brutto' => array(false, 127.449),
						'sum/preis' => array(false, 107.1),						
						'sum/preis_gesamt_netto' => array(false, 107.1),
						'sum/preis_gesamt_brutto' => array(false, 127.449),
						'sum/preis_gesamt' => array(false, 107.1),
					),
					'array' => $basket->toArray(),
					'config' => $this->showConfiguration()
				);
				
			}
			
		} // private function test4()

		/**
		 * Testfall 5
		 * 
		 * 1 Produkt 19%/119€Brutto
		 * - Keine Versandarten
		 * - 1 Gutschein Wert 10Euro
		 * - Kein Rabatt
		 */
		private function test5()
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 2
					)
				),
				'gs' => array(
					'value' => 10,
					'calc' => 'w',
					'code' => 'Wert10',
					'id' => 1
				)
			);

			$this->shop->update_option('wpsg_kleinunternehmer', '1');
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO); 
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '1 Produkt (119€/19%) mit Gutschein (10€) / Kleinunternehmerregelung',
				'tests' => array(
					'sum/mwst' => array(false, 0),
					'sum/preis_netto' => array(false, 90),
					'sum/preis_brutto' => array(false, 90),
					'sum/preis' => array(false, 90),		
					'sum/preis_gesamt_netto' => array(false, 90),
					'sum/preis_gesamt_brutto' => array(false, 90),
					'sum/preis_gesamt' => array(false, 90),						
					'sum/gs_netto' => array(false, 10),
					'sum/gs_brutto' => array(false, 10),
					'sum/gs' => array(false, 10)
				),
				'array' => $basket->toArray(),
				'config' => $this->showConfiguration()
			);
			
		} // private function test5()
		
		/**
		 * Testfall 6
		 * 
		 * 1 Produkt 19%/119€Brutto
		 * - Keine Versandarten
		 * - 1 Gutschein Wert 10%
		 * - Kein Rabatt
		 */
		private function test6()
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 2
					)
				),
				'gs' => array(
					'value' => 10,
					'calc' => 'p',
					'code' => 'Proz10',
					'id' => 2
				)
			);

			$this->shop->update_option('wpsg_kleinunternehmer', '1');
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO); 
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '1 Produkt (119€/19%) mit Gutschein (10%) / Kleinunternehmerregelung',
				'tests' => array(
					'sum/mwst' => array(false, 0),
					'sum/preis_netto' => array(false, 90),
					'sum/preis_brutto' => array(false, 90),
					'sum/preis' => array(false, 90),		
					'sum/preis_gesamt_netto' => array(false, 90),
					'sum/preis_gesamt_brutto' => array(false, 90),
					'sum/preis_gesamt' => array(false, 90),						
					'sum/gs_netto' => array(false, 10),
					'sum/gs_brutto' => array(false, 10),
					'sum/gs' => array(false, 10)
				),
				'array' => $basket->toArray(),
				'config' => $this->showConfiguration()
			);
			
		} // private function test6()
		
		/**
		 * 
		 * 5 Produkt 19%/119€Brutto
		 * - Keine Versandarten
		 * - 1 Gutschein Wert 10%
		 * - 50€ Rabatt
		 */
		private function test7() 
		{
			
			$this->resetConfig();
			
			// Rabatt konfigurieren
			$this->shop->update_option('wpsg_mod_discount_data', unserialize('s:91:"a:2:{i:0;a:1:{s:6:"rabatt";s:1:"0";}i:1;a:2:{s:5:"value";s:3:"250";s:6:"rabatt";s:2:"50";}}";'));
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 5,
						'id' => 2
					)
				),
				'gs' => array(
					'value' => 10,
					'calc' => 'p',
					'code' => 'Proz10',
					'id' => 2
				)
			);
 
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_NETTO); 
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '5 Produkte (je 119€/19%) mit Gutschein (10%) und Rabatt 50€ / Brutto - Netto',
				'tests' => array(
					'sum/mwst' => array(false, 77.516806722689),
					'sum/preis_netto' => array(false, 407.98319327731),
					'sum/preis_brutto' => array(false, 485.5),
					'sum/preis' => array(false, 407.98319327731),		
					'sum/preis_gesamt_netto' => array(false, 407.98319327731),
					'sum/preis_gesamt_brutto' => array(false, 485.5),
					'sum/preis_gesamt' => array(false, 407.98319327731),						
					'sum/gs_netto' => array(false, 50),
					'sum/gs_brutto' => array(false, 59.5),
					'sum/gs' => array(false, 50)
				),
				'array' => $basket->toArray(),
				'config' => $this->showConfiguration()
			);
			
		} // private function test7()
		
		private function test8()
		{
			
			$this->resetConfig();
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_NETTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_NETTO);
			$this->shop->update_option('wpsg_kleinunternehmer', false);
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 3
					)
				),
				'gs' => array(
					'value' => 5,
					'calc' => 'w',
					'code' => 'Wert10',
					'id' => 1
				),
				'checkout' => array(
					'land' => '1',
					'shipping' => '6_1'					
				)
			);
			
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '3€ Produkt mit 5€ Gutschein und 4€ Versandkosten',
				'tests' => array(
					'sum/mwst' => array(false, 0),
					'sum/preis_netto' => array(false, 0),
					'sum/preis_brutto' => array(false, 0),
					'sum/preis' => array(false, 0),
					'sum/preis_gesamt_netto' => array(false, 2),
					'sum/preis_gesamt_brutto' => array(false, 2),
					'sum/preis_gesamt' => array(false, 2),
					'sum/gs_netto' => array(false, 5),
					'sum/gs_brutto' => array(false, 5),
					'sum/gs' => array(false, 5)
				),
				'array' => $basket->toArray(),
				'config' => $this->showConfiguration()
			);
			
		} // private function test8()
		
		private function test9()
		{
			
			$arShippingGesamt = array(1,2,3,4,5);
			 
			$arTest1_Produkt1 = array(1);
			$arTest1_Produkt2 = array(5,4,3);
			$arTest1_Produkt3 = array(2,3,4);
			$arTest1_Produkt4 = array(5);
						
			$arMergeTest1_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest1_Produkt1);
			$arMergeTest1_2 = $this->shop->mergeShipping($arMergeTest1_1, $arTest1_Produkt2);			
			$arMergeTest1_3 = $this->shop->mergeShipping($arMergeTest1_2, $arTest1_Produkt3); 			
			$arMergeTest1_4 = $this->shop->mergeShipping($arMergeTest1_3, $arTest1_Produkt4); 
			 
			$arTest2_Produkt1 = array(1,2);
			$arTest2_Produkt2 = array(3,4);
				
			$arMergeTest2_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest2_Produkt1);
			$arMergeTest2_2 = $this->shop->mergeShipping($arMergeTest2_1, $arTest2_Produkt2);
			 
			$arTest3_Produkt1 = array(1);
			$arTest3_Produkt2 = array(2);
			$arTest3_Produkt3 = array(1,2);
			
			$arMergeTest3_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest3_Produkt1);
			$arMergeTest3_2 = $this->shop->mergeShipping($arMergeTest3_1, $arTest3_Produkt2);
			$arMergeTest3_3 = $this->shop->mergeShipping($arMergeTest3_2, $arTest3_Produkt3);
		 
			$result = array(
				'test1_merge1' => sizeof($arMergeTest1_1).':'.$arMergeTest1_1[0],
				'test1_merge2' => sizeof($arMergeTest1_2).':'.implode(',', $arMergeTest1_2[0]).' '.implode(',', $arMergeTest1_2[1]).' '.implode(',', $arMergeTest1_2[2]),
				'test1_merge3' => sizeof($arMergeTest1_3).':'.implode(',', $arMergeTest1_3[0]).' '.implode(',', $arMergeTest1_3[1]).' '.implode(',', $arMergeTest1_3[2])
					.' '.implode(',', $arMergeTest1_3[3]).' '.implode(',', $arMergeTest1_3[4]).' '.implode(',', $arMergeTest1_3[5])
					.' '.implode(',', $arMergeTest1_3[6]).' '.implode(',', $arMergeTest1_3[7]),
				'test1_merge4' => sizeof($arMergeTest1_4).':'.implode(',', $arMergeTest1_4[0]).' '.implode(',', $arMergeTest1_4[1]).' '.implode(',', $arMergeTest1_4[2]),
				'test2_merge1' => sizeof($arMergeTest2_1).':'.implode(',', $arMergeTest2_1),
				'test2_merge2' => sizeof($arMergeTest2_2).':'.implode(',', $arMergeTest2_2[0]).' '.implode(',', $arMergeTest2_2[1]).' '.implode(',', $arMergeTest2_2[2]).' '.implode(',', $arMergeTest2_2[3]),
				'test3_merge1' => sizeof($arMergeTest3_1).':'.implode(',', $arMergeTest3_1),
				'test3_merge2' => sizeof($arMergeTest3_2).':'.implode(',', $arMergeTest3_2[0]),
				'test3_merge3' => sizeof($arMergeTest3_3).':'.implode(',', $arMergeTest3_3[0])
			);
			
			$this->shop->view['test'][] = array(
				'label' => 'Test der Funktion "Merge Versandarten"',
				'tests' => array(
					'test1_merge1' => array('Test1 nach Merge1 mit Produkt1', '1:1'),
					'test1_merge2' => array('Test1 nach Merge2 mit Produkt2', '3:1,5 1,4 1,3'),						
					'test1_merge3' => array('Test1 nach Merge3 mit Produkt3', '8:1,5,2 1,5,3 1,5,4 1,4,2 1,4,3 1,4 1,3,2 1,3'),
					'test1_merge4' => array('Test1 nach Merge4 mit Produkt4', '3:1,5,2 1,5,3 1,5,4'),
					'test2_merge1' => array('Test2 nach Merge1 mit Produkt1', '2:1,2'),
					'test2_merge2' => array('Test2 nach Merge2 mit Produkt2', '4:1,3 1,4 2,3 2,4'),
					'test3_merge1' => array('Test3 nach Merge1 mit Produkt1', '1:1'), 
					'test3_merge2' => array('Test3 nach Merge2 mit Produkt2', '1:1,2'),
					'test3_merge3' => array('Test3 nach Merge3 mit Produkt3', '1:1,2'),
				),
				'array' => $result
			);
			
			
		}
		
		function test10()
		{

			$this->resetConfig();
			
			$_SESSION['wpsg']['basket'] = array(
				0 => array(
					'menge' => 1,
					'id' => 1
				),
				1 => array(
					'menge' => 1,
					'id' => 2
				)
			);
			$_SESSION['wpsg']['checkout']['land'] = 3;
				 
			$basket = new wpsg_basket();
			$basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto / Schweiz mit "Keine MwSt."',
				'tests' => array(
					'sum/mwst' => array(false, 0),
					'sum/preis_netto' => array(false, 200),
					'sum/preis_brutto' => array(false, 200),
					'sum/preis' => array(false, 200),
					'sum/preis_gesamt_netto' => array(false, 200),
					'sum/preis_gesamt_brutto' => array(false, 200),
					'sum/preis_gesamt' => array(false, 200)					
				),
				'array' => $basket->toArray(),
				'config' => $this->showConfiguration()
			);
		
		}
		
		function test11($ust = false)
		{
		
			$this->resetConfig();
				
			$_SESSION['wpsg']['basket'] = array(
				0 => array(
					'menge' => 1,
					'id' => 1
				),
				1 => array(
					'menge' => 1,
					'id' => 2
				)
			);
			$_SESSION['wpsg']['checkout']['land'] = 2;
			
			if ($ust === true) $_SESSION['wpsg']['checkout']['ustidnr'] = 'AT1234';
				
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
				
			$this->shop->view['test'][] = array(
				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto / Österreich mit "Keine MwSt. bei UStIdNr." '.(($ust === true)?'(UStIdNr. gesetzt)':''),
				'tests' => array(
					'sum/mwst' => array(false, (($ust == true)?0:26)),
					'sum/preis_netto' => array(false, (($ust == true)?200:200)),
					'sum/preis_brutto' => array(false, (($ust == true)?200:226)),
					'sum/preis' => array(false, (($ust == true)?200:226)),
					'sum/preis_gesamt_netto' => array(false, (($ust == true)?200:200)),
					'sum/preis_gesamt_brutto' => array(false, (($ust == true)?200:226)),
					'sum/preis_gesamt' => array(false, (($ust == true)?200:226))
				),
				'array' => $this->shop->basket->toArray(),
				'config' => $this->showConfiguration()
			);
		
		}
		
		public function test12()
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 4
					), 
				),
				'checkout' => array(
					'shipping' => '6_1',
					'land' => '1'	
				)
			);
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_NETTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
			
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
			
			$this->shop->view['test'][] = array(
					'label' => '1 Produkt (100 + 19%) MwSt / Netto - Brutto / 4,- Netto Versand',
					'tests' => array(
							'sum/mwst' => array(false, 19.76),
							'sum/preis_netto' => array(false, 100),
							'sum/preis_brutto' => array(false, 119),
							'sum/preis' => array(false, 119),
							'sum/preis_gesamt_netto' => array(false, 104),
							'sum/preis_gesamt_brutto' => array(false, 123.76),
							'sum/preis_gesamt' => array(false, 123.76)
					),
					'array' => $this->shop->basket->toArray(),
					'config' => $this->showConfiguration()
			);
			
		}
		
		public function test13()
		{
				
			$this->resetConfig();
				
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 2
					),
				),
				'checkout' => array(
					'shipping' => '6_1',
					'land' => '1'
				)
			);
				
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
				
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
				
			$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119) / Brutto - Brutto / 4,- Brutto Versand',
					'tests' => array(
							'sum/mwst' => array(false, 19.638655462185),
							'sum/preis_netto' => array(false, 100),
							'sum/preis_brutto' => array(false, 119),
							'sum/preis' => array(false, 119),
							'sum/preis_gesamt_netto' => array(false, 103.36134453782),
							'sum/preis_gesamt_brutto' => array(false, 123),
							'sum/preis_gesamt' => array(false, 123)
					),
					'array' => $this->shop->basket->toArray(),
					'config' => $this->showConfiguration()
			);
				
		}
		
		public function test14()
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 5
					),
				),
				'checkout' => array(
					'shipping' => '6_1',
					'land' => '2'
				)
			);
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
			
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '1 Produkt (119 mit Leistungsort) / Brutto - Brutto / 4,- Brutto Versand -> Versand nach AT (20% MwSt. statt 19%)',
				'tests' => array(
					'sum/mwst' => array(false, 20.672268907563),
					'sum/preis_netto' => array(false, 100),
					'sum/preis_brutto' => array(false, 120),
					'sum/preis' => array(false, 120),
					'sum/preis_gesamt_netto' => array(false, 103.36134453782),
					'sum/preis_gesamt_brutto' => array(false, 124.03361344538),
					'sum/preis_gesamt' => array(false, 124.03361344538)
				),
				'array' => $this->shop->basket->toArray(),
				'config' => $this->showConfiguration()
			);
			
		}
		
		public function test15() 
		{
			
			$this->resetConfig();
			
			$_SESSION['wpsg'] = array(
				'basket' => array(
					0 => array(
						'menge' => 1,
						'id' => 'vp_6/0_2'
					),
				),
				'checkout' => array( 
					'land' => '2'
				)
			);
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
			
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
			
			$this->shop->view['test'][] = array(
				'label' => '1 Variantenprodukt (149 mit Leistungsort) / Brutto - Brutto / -> Versand nach AT (20% MwSt. statt 19%)',
				'tests' => array(
					'sum/mwst' => array(false, 25.04),
					'sum/preis_netto' => array(false, 125.21),
					'sum/preis_brutto' => array(false, 150.25),
					'sum/preis' => array(false, 150.25),
					'sum/preis_gesamt_netto' => array(false, 125.21),
					'sum/preis_gesamt_brutto' => array(false, 150.25),
					'sum/preis_gesamt' => array(false, 150.25)
				),
				'array' => $this->shop->basket->toArray(),
				'config' => $this->showConfiguration()
			); 
			
		}
		
		public function test16() 
		{
			
			$this->resetConfig();
				
			$_SESSION['wpsg'] = array(
					'basket' => array(
							0 => array(
									'menge' => 1,
									'id' => '2'
							),
					),
					'checkout' => array(
							'land' => '2'
					)
			);
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
				
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
			
			$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119) / Brutto - Brutto / -> Versand nach AT (19% MwSt.)',
					'tests' => array(
							'sum/mwst' => array(false, 19),
							'sum/preis_netto' => array(false, 100),
							'sum/preis_brutto' => array(false, 119),
							'sum/preis' => array(false, 119),
							'sum/preis_gesamt_netto' => array(false, 100),
							'sum/preis_gesamt_brutto' => array(false, 119),
							'sum/preis_gesamt' => array(false, 119)
					),
					'array' => $this->shop->basket->toArray(),
					'config' => $this->showConfiguration()
			);
			
		}
		
		public function test17()
		{
				
			$this->resetConfig();
		
			$_SESSION['wpsg'] = array(
					'basket' => array(
							0 => array(
									'menge' => 1,
									'id' => '5'
							),
					),
					'checkout' => array(
							'land' => '2'
					)
			);
				
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
		
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
				
			$this->shop->view['test'][] = array(
					'label' => '1 Produkt (119 mit Leistungsort) / Brutto - Brutto / -> Versand nach AT (20% MwSt., da Leistungsort)',
					'tests' => array(
							'sum/mwst' => array(false, 20),
							'sum/preis_netto' => array(false, 100),
							'sum/preis_brutto' => array(false, 120),
							'sum/preis' => array(false, 120),
							'sum/preis_gesamt_netto' => array(false, 100),
							'sum/preis_gesamt_brutto' => array(false, 120),
							'sum/preis_gesamt' => array(false, 120)
					),
					'array' => $this->shop->basket->toArray(),
					'config' => $this->showConfiguration()
			);
				
		}

		public function test18()
		{
		
			$this->resetConfig();
		
			$_SESSION['wpsg'] = array(
					'basket' => array(
							0 => array(
									'menge' => 1,
									'id' => '7'
							),
							1 => array(
									'menge' => 1,
									'id' => '7'
							),
							2 => array(
									'menge' => 1,
									'id' => '7'
							),
					),
					'checkout' => array(
							'land' => '2'
					)
			);
		
			$this->shop->update_option('wpsg_mod_discount', time());
			$this->shop->update_option('wpsg_mod_discount_productdiscount', '1');
			
			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
		
			$this->shop->basket = new wpsg_basket();
			$this->shop->basket->initFromSession();
		
			$this->shop->view['test'][] = array(
					'label' => '3 x das gleiche Produkt mit Rabatt für Test Rundungen (Rabatt muß aktiv sein)',
					'tests' => array(
							'sum/mwst' => array(false, 0),
							'sum/preis_netto' => array(false, 45),
							'sum/preis_brutto' => array(false, 45),
							'sum/preis' => array(false, 45),
							'sum/preis_gesamt_netto' => array(false, 45),
							'sum/preis_gesamt_brutto' => array(false, 45),
							'sum/preis_gesamt' => array(false, 45)
					),
					'array' => $this->shop->basket->toArray(),
					'config' => $this->showConfiguration()
			);
		
		}
		
		/**
		 * Zeigt wichtige Einstellungen an, die für den Test sinnvoll sind
		 */
		public function showConfiguration()
		{
			
			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_test/showConfiguration.phtml', false);
			
		} // public function showConfiguration()
		
		/**
		 * Gibt true zurck wenn der gesamte Test erfolgreich war
		 * @param unknown_type $test
		 */
		public function checkTest($test)
		{
						
			foreach ($test['tests'] as $key => $t)
			{
				
				$bTest = $this->checkValue($key, $t[1], $test['array']);
				if ($bTest === false) return false;
				
			}
			
			return true;
			
		} // public function checkTest($test)
		
		/**
		 * Prüft einen einzelnen Wert in einem Array
		 * key kann dabei die Syntax: sum/mwst haben und greift dann auf $array['sum']['mwst'] zu um den Wert zu ermitteln
		 */
		public function checkValue($key, $value, $array)
		{
			
			return $this->checkEqual($this->getValue($key, $array), $value);
			
		} // public function checkValue($key, $array)
		
		/**
		 * Gibt einen Wert aus dem Array zurück anhand des key
		 */
		public function getValue($key, $array)
		{
			
			$arKeys = wpsg_trim(explode('/', $key));
			
			foreach ($arKeys as $k)
			{
				
				$array = $array[$k];
				
			}
			
			return $array;
			
		} // public function getValue($key, $array)
		
		/**
		 * Prüft zwei Werte ob sie gleich sind
		 */
		public function checkEqual($value1, $value2)
		{
			
			if (strval($value1) == strval($value2)) return true;
			
			return false;
			
		} // public function checkEqual($value1, $value2)
		 
	} // class wpsg_mod_test extends wpsg_mod_basic

?>