PageRenderTime 39ms CodeModel.GetById 16ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

/unit-test/testcase/test_album.type.policy.php

http://buddypress-media.googlecode.com/
PHP | 997 lines | 434 code | 412 blank | 151 comment | 84 complexity | 985ff361f97d9d857175eb7a0f6eed60 MD5 | raw file
  1<?php
  2
  3/**
  4 * BP-MEDIA UNIT TEST SCRIPT - ALBUM TYPES POLICY SUB CLASS
  5 * Exercises all functions of the class
  6 *
  7 * @version 0.1.9
  8 * @since 0.1.9
  9 * @package BP-Media
 10 * @subpackage Unit Test
 11 * @license GPL v2.0
 12 * @link http://code.google.com/p/buddypress-media/
 13 *
 14 * ========================================================================================================
 15 */
 16
 17
 18class core_albumType_policy extends BPM_testCase {
 19
 20	var $cls;
 21	var $check_array = array();
 22
 23	var $module_id_max = 5;
 24	var $type_id_max = 5;
 25	var $branch_id_max = 3;
 26	var $key_max = 5;
 27
 28
 29    	function setUp() {
 30
 31		parent::setUp();
 32		
 33		$this->cls = new BPM_albumTypePolicy();
 34		$result = $this->cls->install(&$error);
 35
 36		$this->assertEquals(true, $result, BPM_debug::formatError_print($error) );
 37		unset($error);
 38	}
 39
 40
 41	function generateData($type=null){
 42
 43
 44		$valid_types = array("null", "bool", "int", "float", "string", "array", "object");
 45
 46		if($type === null){	// "0" is a valid type
 47
 48			$current_type = $valid_types[mt_rand(0,6)];
 49		}
 50		else {
 51			// Using the modulus operator causes the function to cycle
 52			// through types if $type variable exceeds (int)5.
 53			$type_idx = $type % 6;
 54			$current_type = $valid_types[$type_idx];
 55		}
 56
 57		switch($current_type){
 58
 59			case "null" : {
 60
 61				$val = null;
 62
 63			} break;
 64
 65			case "bool" : {
 66
 67				$val = mt_rand(0,1);
 68				$val = (bool)$val;
 69
 70			} break;
 71
 72			case "int" : {
 73
 74				$val = mt_rand(-100,100);
 75				$val = (int)$val;
 76
 77			} break;
 78
 79			case "float" : {
 80
 81				$val = (mt_rand(-100,100) / 17);
 82				$val = (float)$val;
 83
 84			} break;
 85
 86			case "string" : {
 87
 88				$width = mt_rand(0, 87);
 89				$val = BPM_sUtil::random_string($width);
 90
 91			} break;
 92
 93			case "array" : {
 94
 95				$named_keys = mt_rand(0,1);
 96				$val = array();
 97
 98				if(!$named_keys){
 99
100					for($i=0; $i<5; $i++){
101						$val[] = mt_rand(-2500, 2500);
102					}
103				}
104				else {
105
106					for($i=0; $i<5; $i++){
107
108						$width = mt_rand(1, 37);
109
110						// PHP does not support arrays with numeric string keys. It silently converts them
111						// to int keys. For example: $test_array["1234"] = "foo"; $test_array["bar"] = "baz";
112						// var_dump($test_array) produces [ test_array[(int)1234] = "foo", test_array[(string)bar]
113						// = "baz"]
114						//
115						// BPM_sUtil::random_string() can (and does) produce values like (string)7. To avoid
116						// debugging problems, prepend all the key names with "k" to ensure PHP treats them as strings.
117
118						$key_name = "k" . BPM_sUtil::random_string($width);
119						$val[$key_name] = mt_rand(-2500, 2500);
120					}
121				}
122
123			} break;
124
125			case "object" : {
126
127				$val = new stdClass();
128
129				for($i=0; $i<3; $i++){
130
131					$width = mt_rand(1, 17);
132
133					// We prepend all the key names with "k" because BPM_sUtil::random_string()
134					// can (and does) produce values like (string)7, which is an illegal name for a
135					// variable in an object [you can't do $test_object->7 = "foo"; ...because the parser
136					// doesn't know if you mean (string)7 or (int)7 ]
137					//
138					// But, PHP *doesn't catch* this defect when the variable name is created dynamically
139					// [ $name = "7"; $test_object->{$name} = "foo" ]. Instead, it converts the key's type
140					// from (string)7 to (int)7 and allows the variable to be accessed only if the name is
141					// created dynamically [$name = "7"; echo ($test_object->{$name}; ]
142
143					$key_name = "k" . BPM_sUtil::random_string($width);
144					$val->{$key_name} = mt_rand(-2500, 2500);
145				}
146
147			} break;
148
149		} // End of switch($current_type)
150
151		return $val;
152
153	}
154
155
156	function load_table(){
157
158
159		// Fill table with policy options having random sizes
160		// and data types. Save a copy of these to a local array.
161		// =================================================================
162
163		$total_keys = 0;
164
165		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
166
167		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
168
169			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
170
171			    for ($key=1; $key < $this->key_max; $key++) {
172
173
174				// Cycle through data types for the first 50 keys, then
175				// randomly pick data types
176				if($total_keys < 50){
177					$val = self::generateData($total_keys);
178				}
179				else {
180					$val = self::generateData();
181				}
182
183				$key_name = "key" . $key;
184
185				// Write generated value to policy class and check array
186				$set_ok = $this->cls->setKey($module_id, $type_id, $branch_id, $key_name, $val, &$error);
187
188				$this->assertEquals(true, $set_ok, BPM_debug::formatError_print($error) );
189				unset($error);
190
191				$this->check_array[$module_id][$type_id][$branch_id][$key_name] = $val;
192
193				$total_keys++;
194
195			    } // ENDOF for( $key
196
197			} // ENDOF for( $branch_id
198
199		    } // ENDOF: for( $type_id
200
201		} // ENDOF: for( $module_id
202
203	}
204
205
206	function check_table(){
207
208		// Load every key stored to the table and compare it against
209		// the value stored in the check array, making sure data types were
210		// correctly recovered (bool) false doesn't become (int) 0 or "NULL"
211		// ====================================================================
212
213		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
214
215		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
216
217			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
218
219			    for ($key=1; $key < $this->key_max; $key++) {
220
221				    $key_name = "key" . $key;
222
223				    $expected = $this->check_array[$module_id][$type_id][$branch_id][$key_name];
224				    $result = $this->cls->getKey($module_id, $type_id, $branch_id, $key_name, &$valid);
225
226				    if( is_array($this->check_array[$module_id][$type_id][$branch_id]) &&
227					array_key_exists($key_name, $this->check_array[$module_id][$type_id][$branch_id]) ){
228
229					    $key_exists = true;
230				    }
231				    else {
232					    $key_exists = false;
233				    }
234
235
236				    if($key_exists){
237					//var_dump($result);
238					    $this->assertEquals($expected, $result);
239
240					    $this->assertEquals(true, $valid);
241				    }
242				    else {
243					    $this->assertEquals(null, $result);
244					    $this->assertEquals(false, $valid);
245				    }
246
247			    }
248			}
249		    }
250		}
251
252	}
253
254
255	function test_create(){
256
257		// Clear the db
258		$this->cls->truncate();
259
260		// Delete all entries in the class cache
261		$this->cls->flushCache();
262
263		// Load the database and check array with test data
264		self::load_table();
265
266		// Verify the stored data matches the check array
267		self::check_table();
268
269
270	} // End of test_create
271
272
273	
274	function test_update(){
275
276		// Clear the db
277		$this->cls->truncate();
278
279		// Delete all entries in the class cache
280		$this->cls->flushCache();
281
282		// Load the database and check array with test data
283		self::load_table();
284		
285		// Overwrite half of the items in the table with random new data
286		// of random type
287		// =================================================================
288		$total_keys = 0;
289		
290		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
291
292		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
293
294			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
295
296			    for ($key=1; $key < $this->key_max; $key++) {
297
298				$overwrite = mt_rand(0,1);
299
300				if($overwrite){
301
302					// Cycle through data types for the first 50 keys, then
303					// randomly pick data types
304					if($total_keys < 50){
305						$val = self::generateData($total_keys);
306					}
307					else {
308						$val = self::generateData();
309					}
310
311					$key_name = "key" . $key;
312
313					// Write generated value to policy class and check array. Note: we cannot check for
314					// a "true" return value from the function, because in some cases the overwrite function
315					// tries to write the same value that is currently in a key to a key ...in which case
316					// the db returns (int)0 because no rows were changed by the query, and so setKey()
317					// returns (bool)false as a result.
318
319					$this->cls->setKey($module_id, $type_id, $branch_id, $key_name, $val);
320
321					$this->check_array[$module_id][$type_id][$branch_id][$key_name] = $val;
322
323					$total_keys++;
324
325				}   // ENDOF if($overwrite)
326
327			    } // ENDOF for( $key
328
329			} // ENDOF for( $branch_id
330
331		    } // ENDOF: for( $type_id
332
333		} // ENDOF: for( $module_id
334
335
336		// Verify the stored data matches the check array
337		self::check_table();
338
339
340	} // End of test_update
341
342	
343
344	function test_dropKey_single(){
345
346		// Clear the db
347		$this->cls->truncate();
348
349		// Delete all entries in the class cache
350		$this->cls->flushCache();
351
352		// Load the database and check array with test data
353		self::load_table();
354
355		// Drop half of the items in the table, using single string dropKey
356		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
357
358		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
359
360			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
361
362			    for ($key=1; $key < $this->key_max; $key++) {
363
364				$key_name = "key" . $key;
365				$drop = mt_rand(0,1);
366
367				if($drop){
368
369				    // Drop the key
370				    $this->cls->dropKey($module_id, $type_id, $branch_id, $key_name);
371				    unset($this->check_array[$module_id][$type_id][$branch_id][$key_name]);
372
373
374				}   // ENDOF if($drop)
375
376			    } // ENDOF for( $key
377
378			} // ENDOF for( $branch_id
379
380		    } // ENDOF: for( $type_id
381
382		} // ENDOF: for( $module_id
383
384
385		// Verify the stored data matches the check array
386		self::check_table();
387
388
389	} // End of test_dropKey_single
390
391
392	function test_dropBranch_single(){
393
394		// Clear the db
395		$this->cls->truncate();
396
397		// Delete all entries in the class cache
398		$this->cls->flushCache();
399
400		// Load the database and check array with test data
401		self::load_table();
402
403		// Drop half of the items in the table, using single string dropBranch
404		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
405
406		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
407
408			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
409
410				$drop = mt_rand(0,1);
411
412				if($drop){
413
414				    // Drop the branch
415				    $this->cls->dropBranch($module_id, $type_id, $branch_id);
416				    unset($this->check_array[$module_id][$type_id][$branch_id]);
417
418
419				}   // ENDOF if($drop)
420
421			} // ENDOF for( $branch_id
422
423		    } // ENDOF: for( $type_id
424
425		} // ENDOF: for( $module_id
426
427
428		// Verify the stored data matches the check array
429		self::check_table();
430
431
432	} // End of test_dropBranch_single
433
434
435	function test_dropType_single(){
436
437		// Clear the db
438		$this->cls->truncate();
439
440		// Delete all entries in the class cache
441		$this->cls->flushCache();
442
443		// Load the database and check array with test data
444		self::load_table();
445
446		// Drop half of the items in the table, using single string dropType
447		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
448
449		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
450
451			    $drop = mt_rand(0,1);
452
453			    if($drop){
454
455				// Drop the branch
456				$this->cls->dropType($module_id, $type_id);
457				unset($this->check_array[$module_id][$type_id]);
458
459
460			    }   // ENDOF if($drop)
461
462		    } // ENDOF: for( $type_id
463
464		} // ENDOF: for( $module_id
465
466
467		// Verify the stored data matches the check array
468		self::check_table();
469
470
471	} // End of test_dropType_single
472
473
474	function test_dropModule_single(){
475
476		// Clear the db
477		$this->cls->truncate();
478
479		// Delete all entries in the class cache
480		$this->cls->flushCache();
481
482		// Load the database and check array with test data
483		self::load_table();
484
485		// Drop half of the items in the table, using single string dropModule
486		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
487
488			    $drop = mt_rand(0,1);
489
490			    if($drop){
491
492				// Drop the branch
493				$this->cls->dropModule($module_id);
494				unset($this->check_array[$module_id]);
495
496			    }   // ENDOF if($drop)
497
498		} // ENDOF: for( $module_id
499
500
501		// Verify the stored data matches the check array
502		self::check_table();
503
504
505	} // End of test_dropModule_single
506
507
508	function test_dropKey_array(){
509
510		// Clear the db
511		$this->cls->truncate();
512
513		// Delete all entries in the class cache
514		$this->cls->flushCache();
515
516		// Load the database and check array with test data
517		self::load_table();
518
519		// Drop half of the items in the table, using single string dropKey
520		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
521
522		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
523
524			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
525
526				$drop_array = array();
527
528				$drop = true;
529
530				for ($key=1; $key < $this->key_max; $key++) {
531
532					$key_name = "key" . $key;
533
534					if($drop){
535						$drop_array[] = $key_name;
536						$drop = false;
537					}
538					else {
539						$drop = true;
540					}
541
542				} // ENDOF for( $key
543
544				// Drop the keys
545				$this->cls->dropKey($module_id, $type_id, $branch_id, $drop_array);
546
547				foreach($drop_array as $drop_key){
548					unset($this->check_array[$module_id][$type_id][$branch_id][$drop_key]);
549				}
550
551			} // ENDOF for( $branch_id
552
553		    } // ENDOF: for( $type_id
554
555		} // ENDOF: for( $module_id
556
557
558		// Verify the stored data matches the check array
559		self::check_table();
560
561
562	} // End of test_dropKey_array
563
564
565	
566	function test_dropBranch_array(){
567
568		// Clear the db
569		$this->cls->truncate();
570
571		// Delete all entries in the class cache
572		$this->cls->flushCache();
573
574		// Load the database and check array with test data
575		self::load_table();
576
577		// Drop half of the items in the table, using single string dropKey
578		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
579
580		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
581
582			$drop_array = array();
583			$drop = true;
584
585			for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
586			
587				if($drop){
588					$drop_array[] = $branch_id;
589					$drop = false;
590				}
591				else {
592					$drop = true;
593				}
594
595			} // ENDOF for( $branch_id
596
597			// Drop the branches
598			$this->cls->dropBranch($module_id, $type_id, $drop_array);
599
600			foreach($drop_array as $drop_branch){
601				unset($this->check_array[$module_id][$type_id][$drop_branch]);
602			}
603
604		    } // ENDOF: for( $type_id
605
606		} // ENDOF: for( $module_id
607
608
609		// Verify the stored data matches the check array
610		self::check_table();
611
612
613	} // End of test_dropBranch_array
614	
615	
616	function test_dropType_array(){
617
618		// Clear the db
619		$this->cls->truncate();
620
621		// Delete all entries in the class cache
622		$this->cls->flushCache();
623
624		// Load the database and check array with test data
625		self::load_table();
626
627		// Drop half of the items in the table, using single string dropKey
628		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
629
630		    $drop = true;
631		    $drop_array = array();
632
633		    for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
634
635			    if($drop){
636				    $drop_array[] = $type_id;
637				    $drop = false;
638			    }
639			    else {
640				    $drop = true;
641			    }
642
643		    } // ENDOF: for( $type_id
644
645		    // Drop the types
646		    $this->cls->dropType($module_id, $drop_array);
647
648		    foreach($drop_array as $drop_type){
649			    unset($this->check_array[$module_id][$drop_type]);
650		    }
651
652		} // ENDOF: for( $module_id
653
654
655		// Verify the stored data matches the check array
656		self::check_table();
657
658
659	} // End of test_dropType_array
660
661
662	function test_dropModule_array(){
663
664		// Clear the db
665		$this->cls->truncate();
666
667		// Delete all entries in the class cache
668		$this->cls->flushCache();
669
670		// Load the database and check array with test data
671		self::load_table();
672
673		$drop = true;
674		$drop_array = array();
675
676		// Drop half of the items in the table, using single string dropKey
677		for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
678
679			if($drop){
680				$drop_array[] = $module_id;
681				$drop = false;
682			}
683			else {
684				$drop = true;
685			}
686
687		} // ENDOF: for( $module_id
688
689		// Drop the modules
690		$this->cls->dropModule($drop_array);
691
692		foreach($drop_array as $drop_module){
693			unset($this->check_array[$drop_module]);
694		}
695
696
697		// Verify the stored data matches the check array
698		self::check_table();
699
700
701	} // End of test_dropModule_array
702
703
704	function test_dropSiteKey_single(){
705
706		// Clear the db
707		$this->cls->truncate();
708
709		// Delete all entries in the class cache
710		$this->cls->flushCache();
711
712		// Load the database and check array with test data
713		self::load_table();
714
715		// Drop half of the keys in the table for *all modules*
716
717		for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
718
719		    for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
720
721			for ($key=1; $key < $this->key_max; $key++) {
722
723			    $key_name = "key" . $key;
724			    $drop = mt_rand(0,1);
725
726			    if($drop){
727
728				// Drop the key from the db
729				$this->cls->dropSiteKey($type_id, $branch_id, $key_name);
730
731				// Drop the key from the check array for *all modules*
732				for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
733
734					unset($this->check_array[$module_id][$type_id][$branch_id][$key_name]);
735				}
736
737
738			    }   // ENDOF if($drop)
739
740			} // ENDOF for( $key
741
742		    } // ENDOF for( $branch_id
743
744		} // ENDOF: for( $type_id
745
746
747
748
749		// Verify the stored data matches the check array
750		self::check_table();
751
752
753	} // End of test_dropSiteKey_single
754
755
756	function test_dropSiteKey_array(){
757
758		// Clear the db
759		$this->cls->truncate();
760
761		// Delete all entries in the class cache
762		$this->cls->flushCache();
763
764		// Load the database and check array with test data
765		self::load_table();
766
767
768		for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
769
770		    for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
771
772			$drop_array = array();
773
774			for ($key=1; $key < $this->key_max; $key++) {
775
776			    $key_name = "key" . $key;
777			    $drop = mt_rand(0,1);
778
779			    if($drop){
780
781				// Add key to drop array
782				$drop_array[] = $key_name;
783
784				// Drop the key from the check array for *all modules*
785				for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
786
787					unset($this->check_array[$module_id][$type_id][$branch_id][$key_name]);
788				}
789
790			    }   // ENDOF if($drop)
791
792			} // ENDOF for( $key
793
794			// Drop the array of keys
795			$this->cls->dropSiteKey($type_id, $branch_id, $drop_array);
796
797		    } // ENDOF for( $branch_id
798
799		} // ENDOF: for( $type_id
800
801
802		// Verify the stored data matches the check array
803		self::check_table();
804
805
806	} // End of test_dropSiteKey_array
807
808
809	function test_dropSiteBranch_single(){
810
811		// Clear the db
812		$this->cls->truncate();
813
814		// Delete all entries in the class cache
815		$this->cls->flushCache();
816
817		// Load the database and check array with test data
818		self::load_table();
819
820		// Drop half of the branches in the table for *all modules*
821		for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
822
823		    for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
824
825			$drop = mt_rand(0,1);
826
827			if($drop){
828
829			    // Drop the branch from the db
830			    $this->cls->dropSiteBranch($type_id, $branch_id);
831
832			    // Drop the branch from the check array for *all modules*
833			    for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
834
835				    unset($this->check_array[$module_id][$type_id][$branch_id]);
836			    }
837
838
839			}   // ENDOF if($drop)
840
841		    } // ENDOF for( $branch_id
842
843		} // ENDOF: for( $type_id
844
845
846
847
848		// Verify the stored data matches the check array
849		self::check_table();
850
851
852	} // End of test_dropSiteBranch_single
853
854
855	function test_dropSiteBranch_array(){
856
857		// Clear the db
858		$this->cls->truncate();
859
860		// Delete all entries in the class cache
861		$this->cls->flushCache();
862
863		// Load the database and check array with test data
864		self::load_table();
865
866		// Drop half of the branches in the table for *all modules*
867		for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
868
869		    $drop_array = array();
870
871		    for( $branch_id=1; $branch_id < $this->branch_id_max; $branch_id++) {
872
873			$drop = mt_rand(0,1);
874
875			if($drop){
876
877			    // Add branch to drop array
878			    $drop_array[] = $branch_id;
879
880			    // Drop the branch from the check array for *all modules*
881			    for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
882
883				    unset($this->check_array[$module_id][$type_id][$branch_id]);
884			    }
885
886			}   // ENDOF if($drop)
887
888		    } // ENDOF for( $branch_id
889
890		    // Drop the branches from the db
891		    $this->cls->dropSiteBranch($type_id, $drop_array);
892
893		} // ENDOF: for( $type_id
894
895
896		// Verify the stored data matches the check array
897		self::check_table();
898
899
900	} // End of test_dropSiteBranch_array
901
902
903	function test_dropSiteType_single(){
904
905		// Clear the db
906		$this->cls->truncate();
907
908		// Delete all entries in the class cache
909		$this->cls->flushCache();
910
911		// Load the database and check array with test data
912		self::load_table();
913
914		// Drop half of the keys in the table for *all modules*
915		for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
916
917			$drop = mt_rand(0,1);
918
919			if($drop){
920
921			    // Drop the type from the db
922			    $this->cls->dropSiteType($type_id);
923
924			    // Drop the type from the check array for *all modules*
925			    for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
926
927				    unset($this->check_array[$module_id][$type_id]);
928			    }
929
930
931			}   // ENDOF if($drop)
932
933		} // ENDOF: for( $type_id
934
935
936
937
938		// Verify the stored data matches the check array
939		self::check_table();
940
941
942	} // End of test_dropSiteType_single
943
944
945	function test_dropSiteType_array(){
946
947		// Clear the db
948		$this->cls->truncate();
949
950		// Delete all entries in the class cache
951		$this->cls->flushCache();
952
953		// Load the database and check array with test data
954		self::load_table();
955
956		$drop_array = array();
957
958		// Drop half of the types in the table for *all modules*
959		for( $type_id=1; $type_id < $this->type_id_max; $type_id++) {
960
961			$drop = mt_rand(0,1);
962
963			if($drop){
964
965			    $drop_array[] = $type_id;
966
967			    // Drop the type from the check array for *all modules*
968			    for( $module_id=1; $module_id < $this->module_id_max; $module_id++){
969
970				    unset($this->check_array[$module_id][$type_id]);
971			    }
972
973			}   // ENDOF if($drop)
974
975		} // ENDOF: for( $type_id
976
977
978		// Drop the types from the db
979		$this->cls->dropSiteType($drop_array);
980
981		// Verify the stored data matches the check array
982		self::check_table();
983
984
985	} // End of test_dropSiteType_array
986
987
988	function tearDown() {
989
990		$this->cls->uninstall();
991		parent::tearDown();
992	}
993
994}
995
996
997?>