Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 1
<?php
2
/**
3
 * Mock models file
4
 *
5
 * Mock classes for use in Model and related test cases
6
 *
7
 * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
8
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
9
 *
10
 * Licensed under The MIT License
11
 * For full copyright and license information, please see the LICENSE.txt
12
 * Redistributions of files must retain the above copyright notice
13
 *
14
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
15
 * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
16
 * @package       Cake.Test.Case.Model
17
 * @since         CakePHP(tm) v 1.2.0.6464
18
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
19
 */
20
 
21
App::uses('Model', 'Model');
22
 
23
/**
24
 * AppModel class
25
 *
26
 * @package       Cake.Test.Case.Model
27
 */
28
class AppModel extends Model {
29
 
30
/**
31
 * findMethods property
32
 *
33
 * @var array
34
 */
35
	public $findMethods = array('published' => true);
36
 
37
/**
38
 * useDbConfig property
39
 *
40
 * @var array
41
 */
42
	public $useDbConfig = 'test';
43
 
44
/**
45
 * _findPublished custom find
46
 *
47
 * @return array
48
 */
49
	protected function _findPublished($state, $query, $results = array()) {
50
		if ($state === 'before') {
51
			$query['conditions']['published'] = 'Y';
52
			return $query;
53
		}
54
		return $results;
55
	}
56
 
57
}
58
 
59
/**
60
 * Test class
61
 *
62
 * @package       Cake.Test.Case.Model
63
 */
64
class Test extends CakeTestModel {
65
 
66
/**
67
 * useTable property
68
 *
69
 * @var bool
70
 */
71
	public $useTable = false;
72
 
73
/**
74
 * name property
75
 *
76
 * @var string
77
 */
78
	public $name = 'Test';
79
 
80
/**
81
 * schema property
82
 *
83
 * @var array
84
 */
85
	protected $_schema = array(
86
		'id' => array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key' => 'primary'),
87
		'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
88
		'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
89
		'notes' => array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
90
		'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
91
		'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
92
	);
93
 
94
}
95
 
96
/**
97
 * TestAlias class
98
 *
99
 * @package       Cake.Test.Case.Model
100
 */
101
class TestAlias extends CakeTestModel {
102
 
103
/**
104
 * useTable property
105
 *
106
 * @var bool
107
 */
108
	public $useTable = false;
109
 
110
/**
111
 * name property
112
 *
113
 * @var string
114
 */
115
	public $name = 'TestAlias';
116
 
117
/**
118
 * schema property
119
 *
120
 * @var array
121
 */
122
	protected $_schema = array(
123
		'id' => array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key' => 'primary'),
124
		'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
125
		'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
126
		'notes' => array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
127
		'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
128
		'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
129
	);
130
}
131
 
132
/**
133
 * TestValidate class
134
 *
135
 * @package       Cake.Test.Case.Model
136
 */
137
class TestValidate extends CakeTestModel {
138
 
139
/**
140
 * useTable property
141
 *
142
 * @var bool
143
 */
144
	public $useTable = false;
145
 
146
/**
147
 * name property
148
 *
149
 * @var string
150
 */
151
	public $name = 'TestValidate';
152
 
153
/**
154
 * schema property
155
 *
156
 * @var array
157
 */
158
	protected $_schema = array(
159
		'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
160
		'title' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
161
		'body' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => ''),
162
		'number' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
163
		'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
164
		'modified' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
165
	);
166
 
167
/**
168
 * validateNumber method
169
 *
170
 * @param mixed $value
171
 * @param mixed $options
172
 * @return void
173
 */
174
	public function validateNumber($value, $options) {
175
		$options += array('min' => 0, 'max' => 100);
176
		$valid = ($value['number'] >= $options['min'] && $value['number'] <= $options['max']);
177
		return $valid;
178
	}
179
 
180
/**
181
 * validateTitle method
182
 *
183
 * @param mixed $value
184
 * @return void
185
 */
186
	public function validateTitle($value) {
187
		return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0);
188
	}
189
 
190
}
191
 
192
/**
193
 * User class
194
 *
195
 * @package       Cake.Test.Case.Model
196
 */
197
class User extends CakeTestModel {
198
 
199
/**
200
 * name property
201
 *
202
 * @var string
203
 */
204
	public $name = 'User';
205
 
206
/**
207
 * validate property
208
 *
209
 * @var array
210
 */
211
	public $validate = array('user' => 'notEmpty', 'password' => 'notEmpty');
212
 
213
/**
214
 * beforeFind() callback used to run ContainableBehaviorTest::testLazyLoad()
215
 *
216
 * @return bool
217
 * @throws Exception
218
 */
219
	public function beforeFind($queryData) {
220
		if (!empty($queryData['lazyLoad'])) {
221
			if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) {
222
				throw new Exception('Unavailable associations');
223
			}
224
		}
225
		return true;
226
	}
227
 
228
}
229
 
230
/**
231
 * Article class
232
 *
233
 * @package       Cake.Test.Case.Model
234
 */
235
class Article extends CakeTestModel {
236
 
237
/**
238
 * name property
239
 *
240
 * @var string
241
 */
242
	public $name = 'Article';
243
 
244
/**
245
 * belongsTo property
246
 *
247
 * @var array
248
 */
249
	public $belongsTo = array('User');
250
 
251
/**
252
 * hasMany property
253
 *
254
 * @var array
255
 */
256
	public $hasMany = array('Comment' => array('dependent' => true));
257
 
258
/**
259
 * hasAndBelongsToMany property
260
 *
261
 * @var array
262
 */
263
	public $hasAndBelongsToMany = array('Tag');
264
 
265
/**
266
 * validate property
267
 *
268
 * @var array
269
 */
270
	public $validate = array(
271
		'user_id' => 'numeric',
272
		'title' => array('required' => false, 'rule' => 'notEmpty'),
273
		'body' => array('required' => false, 'rule' => 'notEmpty'),
274
	);
275
 
276
/**
277
 * beforeSaveReturn property
278
 *
279
 * @var bool
280
 */
281
	public $beforeSaveReturn = true;
282
 
283
/**
284
 * beforeSave method
285
 *
286
 * @return void
287
 */
288
	public function beforeSave($options = array()) {
289
		return $this->beforeSaveReturn;
290
	}
291
 
292
/**
293
 * titleDuplicate method
294
 *
295
 * @param string $title
296
 * @return void
297
 */
298
	public static function titleDuplicate($title) {
299
		if ($title === 'My Article Title') {
300
			return false;
301
		}
302
		return true;
303
	}
304
 
305
}
306
 
307
/**
308
 * Model stub for beforeDelete testing
309
 *
310
 * @see #250
311
 * @package       Cake.Test.Case.Model
312
 */
313
class BeforeDeleteComment extends CakeTestModel {
314
 
315
	public $name = 'BeforeDeleteComment';
316
 
317
	public $useTable = 'comments';
318
 
319
	public function beforeDelete($cascade = true) {
320
		$db = $this->getDataSource();
321
		$db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3)));
322
		return true;
323
	}
324
 
325
}
326
 
327
/**
328
 * NumericArticle class
329
 *
330
 * @package       Cake.Test.Case.Model
331
 */
332
class NumericArticle extends CakeTestModel {
333
 
334
/**
335
 * name property
336
 *
337
 * @var string
338
 */
339
	public $name = 'NumericArticle';
340
 
341
/**
342
 * useTable property
343
 *
344
 * @var string
345
 */
346
	public $useTable = 'numeric_articles';
347
 
348
}
349
 
350
/**
351
 * Article10 class
352
 *
353
 * @package       Cake.Test.Case.Model
354
 */
355
class Article10 extends CakeTestModel {
356
 
357
/**
358
 * name property
359
 *
360
 * @var string
361
 */
362
	public $name = 'Article10';
363
 
364
/**
365
 * useTable property
366
 *
367
 * @var string
368
 */
369
	public $useTable = 'articles';
370
 
371
/**
372
 * hasMany property
373
 *
374
 * @var array
375
 */
376
	public $hasMany = array('Comment' => array('dependent' => true, 'exclusive' => true));
377
 
378
}
379
 
380
/**
381
 * ArticleFeatured class
382
 *
383
 * @package       Cake.Test.Case.Model
384
 */
385
class ArticleFeatured extends CakeTestModel {
386
 
387
/**
388
 * name property
389
 *
390
 * @var string
391
 */
392
	public $name = 'ArticleFeatured';
393
 
394
/**
395
 * belongsTo property
396
 *
397
 * @var array
398
 */
399
	public $belongsTo = array('User', 'Category');
400
 
401
/**
402
 * hasOne property
403
 *
404
 * @var array
405
 */
406
	public $hasOne = array('Featured');
407
 
408
/**
409
 * hasMany property
410
 *
411
 * @var array
412
 */
413
	public $hasMany = array('Comment' => array('className' => 'Comment', 'dependent' => true));
414
 
415
/**
416
 * hasAndBelongsToMany property
417
 *
418
 * @var array
419
 */
420
	public $hasAndBelongsToMany = array('Tag');
421
 
422
/**
423
 * validate property
424
 *
425
 * @var array
426
 */
427
	public $validate = array('user_id' => 'numeric', 'title' => 'notEmpty', 'body' => 'notEmpty');
428
 
429
}
430
 
431
/**
432
 * Featured class
433
 *
434
 * @package       Cake.Test.Case.Model
435
 */
436
class Featured extends CakeTestModel {
437
 
438
/**
439
 * name property
440
 *
441
 * @var string
442
 */
443
	public $name = 'Featured';
444
 
445
/**
446
 * belongsTo property
447
 *
448
 * @var array
449
 */
450
	public $belongsTo = array('ArticleFeatured', 'Category');
451
}
452
 
453
/**
454
 * Tag class
455
 *
456
 * @package       Cake.Test.Case.Model
457
 */
458
class Tag extends CakeTestModel {
459
 
460
/**
461
 * name property
462
 *
463
 * @var string
464
 */
465
	public $name = 'Tag';
466
}
467
 
468
/**
469
 * ArticlesTag class
470
 *
471
 * @package       Cake.Test.Case.Model
472
 */
473
class ArticlesTag extends CakeTestModel {
474
 
475
/**
476
 * name property
477
 *
478
 * @var string
479
 */
480
	public $name = 'ArticlesTag';
481
}
482
 
483
/**
484
 * ArticleFeaturedsTag class
485
 *
486
 * @package       Cake.Test.Case.Model
487
 */
488
class ArticleFeaturedsTag extends CakeTestModel {
489
 
490
/**
491
 * name property
492
 *
493
 * @var string
494
 */
495
	public $name = 'ArticleFeaturedsTag';
496
}
497
 
498
/**
499
 * Comment class
500
 *
501
 * @package       Cake.Test.Case.Model
502
 */
503
class Comment extends CakeTestModel {
504
 
505
/**
506
 * name property
507
 *
508
 * @var string
509
 */
510
	public $name = 'Comment';
511
 
512
/**
513
 * belongsTo property
514
 *
515
 * @var array
516
 */
517
	public $belongsTo = array('Article', 'User');
518
 
519
/**
520
 * hasOne property
521
 *
522
 * @var array
523
 */
524
	public $hasOne = array('Attachment' => array('dependent' => true));
525
}
526
 
527
/**
528
 * Modified Comment Class has afterFind Callback
529
 *
530
 * @package       Cake.Test.Case.Model
531
 */
532
class ModifiedComment extends CakeTestModel {
533
 
534
/**
535
 * name property
536
 *
537
 * @var string
538
 */
539
	public $name = 'Comment';
540
 
541
/**
542
 * useTable property
543
 *
544
 * @var string
545
 */
546
	public $useTable = 'comments';
547
 
548
/**
549
 * Property used to toggle filtering of results
550
 *
551
 * @var bool
552
 */
553
	public $remove = false;
554
 
555
/**
556
 * belongsTo property
557
 *
558
 * @var array
559
 */
560
	public $belongsTo = array('Article');
561
 
562
/**
563
 * afterFind callback
564
 *
565
 * @return void
566
 */
567
	public function afterFind($results, $primary = false) {
568
		if (isset($results[0])) {
569
			$results[0]['Comment']['callback'] = 'Fire';
570
		}
571
		if ($this->remove) {
572
			return array();
573
		}
574
		return $results;
575
	}
576
 
577
}
578
 
579
/**
580
 * Modified Comment Class has afterFind Callback
581
 *
582
 * @package       Cake.Test.Case.Model
583
 */
584
class AgainModifiedComment extends CakeTestModel {
585
 
586
/**
587
 * name property
588
 *
589
 * @var string
590
 */
591
	public $name = 'Comment';
592
 
593
/**
594
 * useTable property
595
 *
596
 * @var string
597
 */
598
	public $useTable = 'comments';
599
 
600
/**
601
 * belongsTo property
602
 *
603
 * @var array
604
 */
605
	public $belongsTo = array('Article');
606
 
607
/**
608
 * afterFind callback
609
 *
610
 * @return void
611
 */
612
	public function afterFind($results, $primary = false) {
613
		if (isset($results[0])) {
614
			$results[0]['Comment']['querytype'] = $this->findQueryType;
615
		}
616
		return $results;
617
	}
618
 
619
}
620
 
621
/**
622
 * MergeVarPluginAppModel class
623
 *
624
 * @package       Cake.Test.Case.Model
625
 */
626
class MergeVarPluginAppModel extends AppModel {
627
 
628
/**
629
 * actsAs parameter
630
 *
631
 * @var array
632
 */
633
	public $actsAs = array(
634
		'Containable'
635
	);
636
}
637
 
638
/**
639
 * MergeVarPluginPost class
640
 *
641
 * @package       Cake.Test.Case.Model
642
 */
643
class MergeVarPluginPost extends MergeVarPluginAppModel {
644
 
645
/**
646
 * actsAs parameter
647
 *
648
 * @var array
649
 */
650
	public $actsAs = array(
651
		'Tree'
652
	);
653
 
654
/**
655
 * useTable parameter
656
 *
657
 * @var string
658
 */
659
	public $useTable = 'posts';
660
}
661
 
662
/**
663
 * MergeVarPluginComment class
664
 *
665
 * @package       Cake.Test.Case.Model
666
 */
667
class MergeVarPluginComment extends MergeVarPluginAppModel {
668
 
669
/**
670
 * actsAs parameter
671
 *
672
 * @var array
673
 */
674
	public $actsAs = array(
675
		'Containable' => array('some_settings')
676
	);
677
 
678
/**
679
 * useTable parameter
680
 *
681
 * @var string
682
 */
683
	public $useTable = 'comments';
684
}
685
 
686
/**
687
 * Attachment class
688
 *
689
 * @package       Cake.Test.Case.Model
690
 */
691
class Attachment extends CakeTestModel {
692
 
693
/**
694
 * name property
695
 *
696
 * @var string
697
 */
698
	public $name = 'Attachment';
699
 
700
/**
701
 * belongsTo property
702
 *
703
 * @var array
704
 */
705
	public $belongsTo = array('Comment');
706
}
707
 
708
/**
709
 * ModifiedAttachment class
710
 *
711
 * @package       Cake.Test.Case.Model
712
 */
713
class ModifiedAttachment extends CakeTestModel {
714
 
715
/**
716
 * name property
717
 *
718
 * @var string
719
 */
720
	public $name = 'ModifiedAttachment';
721
 
722
/**
723
 * useTable property
724
 *
725
 * @var string
726
 */
727
	public $useTable = 'attachments';
728
 
729
/**
730
 * afterFind callback
731
 *
732
 * @return void
733
 */
734
	public function afterFind($results, $primary = false) {
735
		if (isset($results['id'])) {
736
			$results['callback'] = 'Fired';
737
		}
738
		return $results;
739
	}
740
 
741
}
742
 
743
/**
744
 * Category class
745
 *
746
 * @package       Cake.Test.Case.Model
747
 */
748
class Category extends CakeTestModel {
749
 
750
/**
751
 * name property
752
 *
753
 * @var string
754
 */
755
	public $name = 'Category';
756
}
757
 
758
/**
759
 * CategoryThread class
760
 *
761
 * @package       Cake.Test.Case.Model
762
 */
763
class CategoryThread extends CakeTestModel {
764
 
765
/**
766
 * name property
767
 *
768
 * @var string
769
 */
770
	public $name = 'CategoryThread';
771
 
772
/**
773
 * belongsTo property
774
 *
775
 * @var array
776
 */
777
	public $belongsTo = array('ParentCategory' => array('className' => 'CategoryThread', 'foreignKey' => 'parent_id'));
778
}
779
 
780
/**
781
 * Apple class
782
 *
783
 * @package       Cake.Test.Case.Model
784
 */
785
class Apple extends CakeTestModel {
786
 
787
/**
788
 * name property
789
 *
790
 * @var string
791
 */
792
	public $name = 'Apple';
793
 
794
/**
795
 * validate property
796
 *
797
 * @var array
798
 */
799
	public $validate = array('name' => 'notEmpty');
800
 
801
/**
802
 * hasOne property
803
 *
804
 * @var array
805
 */
806
	public $hasOne = array('Sample');
807
 
808
/**
809
 * hasMany property
810
 *
811
 * @var array
812
 */
813
	public $hasMany = array('Child' => array('className' => 'Apple', 'dependent' => true));
814
 
815
/**
816
 * belongsTo property
817
 *
818
 * @var array
819
 */
820
	public $belongsTo = array('Parent' => array('className' => 'Apple', 'foreignKey' => 'apple_id'));
821
}
822
 
823
/**
824
 * Sample class
825
 *
826
 * @package       Cake.Test.Case.Model
827
 */
828
class Sample extends CakeTestModel {
829
 
830
/**
831
 * name property
832
 *
833
 * @var string
834
 */
835
	public $name = 'Sample';
836
 
837
/**
838
 * belongsTo property
839
 *
840
 * @var string
841
 */
842
	public $belongsTo = 'Apple';
843
}
844
 
845
/**
846
 * AnotherArticle class
847
 *
848
 * @package       Cake.Test.Case.Model
849
 */
850
class AnotherArticle extends CakeTestModel {
851
 
852
/**
853
 * name property
854
 *
855
 * @var string
856
 */
857
	public $name = 'AnotherArticle';
858
 
859
/**
860
 * hasMany property
861
 *
862
 * @var string
863
 */
864
	public $hasMany = 'Home';
865
}
866
 
867
/**
868
 * Advertisement class
869
 *
870
 * @package       Cake.Test.Case.Model
871
 */
872
class Advertisement extends CakeTestModel {
873
 
874
/**
875
 * name property
876
 *
877
 * @var string
878
 */
879
	public $name = 'Advertisement';
880
 
881
/**
882
 * hasMany property
883
 *
884
 * @var string
885
 */
886
	public $hasMany = 'Home';
887
}
888
 
889
/**
890
 * Home class
891
 *
892
 * @package       Cake.Test.Case.Model
893
 */
894
class Home extends CakeTestModel {
895
 
896
/**
897
 * name property
898
 *
899
 * @var string
900
 */
901
	public $name = 'Home';
902
 
903
/**
904
 * belongsTo property
905
 *
906
 * @var array
907
 */
908
	public $belongsTo = array('AnotherArticle', 'Advertisement');
909
}
910
 
911
/**
912
 * Post class
913
 *
914
 * @package       Cake.Test.Case.Model
915
 */
916
class Post extends CakeTestModel {
917
 
918
/**
919
 * name property
920
 *
921
 * @var string
922
 */
923
	public $name = 'Post';
924
 
925
/**
926
 * belongsTo property
927
 *
928
 * @var array
929
 */
930
	public $belongsTo = array('Author');
931
 
932
/**
933
 * @param array $queryData
934
 * @return bool true
935
 */
936
	public function beforeFind($queryData) {
937
		if (isset($queryData['connection'])) {
938
			$this->useDbConfig = $queryData['connection'];
939
		}
940
		return true;
941
	}
942
 
943
/**
944
 * @param array $results
945
 * @param bool $primary
946
 * @return array results
947
 */
948
	public function afterFind($results, $primary = false) {
949
		$this->useDbConfig = 'test';
950
		return $results;
951
	}
952
 
953
}
954
 
955
/**
956
 * Author class
957
 *
958
 * @package       Cake.Test.Case.Model
959
 */
960
class Author extends CakeTestModel {
961
 
962
/**
963
 * name property
964
 *
965
 * @var string
966
 */
967
	public $name = 'Author';
968
 
969
/**
970
 * hasMany property
971
 *
972
 * @var array
973
 */
974
	public $hasMany = array('Post');
975
 
976
/**
977
 * afterFind method
978
 *
979
 * @param array $results
980
 * @return void
981
 */
982
	public function afterFind($results, $primary = false) {
983
		$results[0]['Author']['test'] = 'working';
984
		return $results;
985
	}
986
 
987
}
988
 
989
/**
990
 * ModifiedAuthor class
991
 *
992
 * @package       Cake.Test.Case.Model
993
 */
994
class ModifiedAuthor extends Author {
995
 
996
/**
997
 * name property
998
 *
999
 * @var string
1000
 */
1001
	public $name = 'Author';
1002
 
1003
/**
1004
 * afterFind method
1005
 *
1006
 * @param array $results
1007
 * @return void
1008
 */
1009
	public function afterFind($results, $primary = false) {
1010
		foreach ($results as $index => $result) {
1011
			$results[$index]['Author']['user'] .= ' (CakePHP)';
1012
		}
1013
		return $results;
1014
	}
1015
 
1016
}
1017
 
1018
/**
1019
 * Project class
1020
 *
1021
 * @package       Cake.Test.Case.Model
1022
 */
1023
class Project extends CakeTestModel {
1024
 
1025
/**
1026
 * name property
1027
 *
1028
 * @var string
1029
 */
1030
	public $name = 'Project';
1031
 
1032
/**
1033
 * hasMany property
1034
 *
1035
 * @var array
1036
 */
1037
	public $hasMany = array('Thread');
1038
}
1039
 
1040
/**
1041
 * Thread class
1042
 *
1043
 * @package       Cake.Test.Case.Model
1044
 */
1045
class Thread extends CakeTestModel {
1046
 
1047
/**
1048
 * name property
1049
 *
1050
 * @var string
1051
 */
1052
	public $name = 'Thread';
1053
 
1054
/**
1055
 * hasMany property
1056
 *
1057
 * @var array
1058
 */
1059
	public $belongsTo = array('Project');
1060
 
1061
/**
1062
 * hasMany property
1063
 *
1064
 * @var array
1065
 */
1066
	public $hasMany = array('Message');
1067
}
1068
 
1069
/**
1070
 * Message class
1071
 *
1072
 * @package       Cake.Test.Case.Model
1073
 */
1074
class Message extends CakeTestModel {
1075
 
1076
/**
1077
 * name property
1078
 *
1079
 * @var string
1080
 */
1081
	public $name = 'Message';
1082
 
1083
/**
1084
 * hasOne property
1085
 *
1086
 * @var array
1087
 */
1088
	public $hasOne = array('Bid');
1089
}
1090
 
1091
/**
1092
 * Bid class
1093
 *
1094
 * @package       Cake.Test.Case.Model
1095
 */
1096
class Bid extends CakeTestModel {
1097
 
1098
/**
1099
 * name property
1100
 *
1101
 * @var string
1102
 */
1103
	public $name = 'Bid';
1104
 
1105
/**
1106
 * belongsTo property
1107
 *
1108
 * @var array
1109
 */
1110
	public $belongsTo = array('Message');
1111
}
1112
 
1113
/**
1114
 * BiddingMessage class
1115
 *
1116
 * @package       Cake.Test.Case.Model
1117
 */
1118
class BiddingMessage extends CakeTestModel {
1119
 
1120
/**
1121
 * name property
1122
 *
1123
 * @var string
1124
 */
1125
	public $name = 'BiddingMessage';
1126
 
1127
/**
1128
 * primaryKey property
1129
 *
1130
 * @var string
1131
 */
1132
	public $primaryKey = 'bidding';
1133
 
1134
/**
1135
 * belongsTo property
1136
 *
1137
 * @var array
1138
 */
1139
	public $belongsTo = array(
1140
		'Bidding' => array(
1141
			'foreignKey' => false,
1142
			'conditions' => array('BiddingMessage.bidding = Bidding.bid')
1143
		)
1144
	);
1145
}
1146
 
1147
/**
1148
 * Bidding class
1149
 *
1150
 * @package       Cake.Test.Case.Model
1151
 */
1152
class Bidding extends CakeTestModel {
1153
 
1154
/**
1155
 * name property
1156
 *
1157
 * @var string
1158
 */
1159
	public $name = 'Bidding';
1160
 
1161
/**
1162
 * hasOne property
1163
 *
1164
 * @var array
1165
 */
1166
	public $hasOne = array(
1167
		'BiddingMessage' => array(
1168
			'foreignKey' => false,
1169
			'conditions' => array('BiddingMessage.bidding = Bidding.bid'),
1170
			'dependent' => true
1171
		)
1172
	);
1173
}
1174
 
1175
/**
1176
 * NodeAfterFind class
1177
 *
1178
 * @package       Cake.Test.Case.Model
1179
 */
1180
class NodeAfterFind extends CakeTestModel {
1181
 
1182
/**
1183
 * name property
1184
 *
1185
 * @var string
1186
 */
1187
	public $name = 'NodeAfterFind';
1188
 
1189
/**
1190
 * validate property
1191
 *
1192
 * @var array
1193
 */
1194
	public $validate = array('name' => 'notEmpty');
1195
 
1196
/**
1197
 * useTable property
1198
 *
1199
 * @var string
1200
 */
1201
	public $useTable = 'apples';
1202
 
1203
/**
1204
 * hasOne property
1205
 *
1206
 * @var array
1207
 */
1208
	public $hasOne = array('Sample' => array('className' => 'NodeAfterFindSample'));
1209
 
1210
/**
1211
 * hasMany property
1212
 *
1213
 * @var array
1214
 */
1215
	public $hasMany = array('Child' => array('className' => 'NodeAfterFind', 'dependent' => true));
1216
 
1217
/**
1218
 * belongsTo property
1219
 *
1220
 * @var array
1221
 */
1222
	public $belongsTo = array('Parent' => array('className' => 'NodeAfterFind', 'foreignKey' => 'apple_id'));
1223
 
1224
/**
1225
 * afterFind method
1226
 *
1227
 * @param mixed $results
1228
 * @return array
1229
 */
1230
	public function afterFind($results, $primary = false) {
1231
		return $results;
1232
	}
1233
 
1234
}
1235
 
1236
/**
1237
 * NodeAfterFindSample class
1238
 *
1239
 * @package       Cake.Test.Case.Model
1240
 */
1241
class NodeAfterFindSample extends CakeTestModel {
1242
 
1243
/**
1244
 * name property
1245
 *
1246
 * @var string
1247
 */
1248
	public $name = 'NodeAfterFindSample';
1249
 
1250
/**
1251
 * useTable property
1252
 *
1253
 * @var string
1254
 */
1255
	public $useTable = 'samples';
1256
 
1257
/**
1258
 * belongsTo property
1259
 *
1260
 * @var string
1261
 */
1262
	public $belongsTo = 'NodeAfterFind';
1263
}
1264
 
1265
/**
1266
 * NodeNoAfterFind class
1267
 *
1268
 * @package       Cake.Test.Case.Model
1269
 */
1270
class NodeNoAfterFind extends CakeTestModel {
1271
 
1272
/**
1273
 * name property
1274
 *
1275
 * @var string
1276
 */
1277
	public $name = 'NodeAfterFind';
1278
 
1279
/**
1280
 * validate property
1281
 *
1282
 * @var array
1283
 */
1284
	public $validate = array('name' => 'notEmpty');
1285
 
1286
/**
1287
 * useTable property
1288
 *
1289
 * @var string
1290
 */
1291
	public $useTable = 'apples';
1292
 
1293
/**
1294
 * hasOne property
1295
 *
1296
 * @var array
1297
 */
1298
	public $hasOne = array('Sample' => array('className' => 'NodeAfterFindSample'));
1299
 
1300
/**
1301
 * hasMany property
1302
 *
1303
 * @var array
1304
 */
1305
	public $hasMany = array('Child' => array('className' => 'NodeAfterFind', 'dependent' => true));
1306
 
1307
/**
1308
 * belongsTo property
1309
 *
1310
 * @var array
1311
 */
1312
	public $belongsTo = array('Parent' => array('className' => 'NodeAfterFind', 'foreignKey' => 'apple_id'));
1313
}
1314
 
1315
/**
1316
 * Node class
1317
 *
1318
 * @package       Cake.Test.Case.Model
1319
 */
1320
class Node extends CakeTestModel {
1321
 
1322
/**
1323
 * name property
1324
 *
1325
 * @var string
1326
 */
1327
	public $name = 'Node';
1328
 
1329
/**
1330
 * hasAndBelongsToMany property
1331
 *
1332
 * @var array
1333
 */
1334
	public $hasAndBelongsToMany = array(
1335
		'ParentNode' => array(
1336
			'className' => 'Node',
1337
			'joinTable' => 'dependency',
1338
			'with' => 'Dependency',
1339
			'foreignKey' => 'child_id',
1340
			'associationForeignKey' => 'parent_id',
1341
		)
1342
	);
1343
}
1344
 
1345
/**
1346
 * Dependency class
1347
 *
1348
 * @package       Cake.Test.Case.Model
1349
 */
1350
class Dependency extends CakeTestModel {
1351
 
1352
/**
1353
 * name property
1354
 *
1355
 * @var string
1356
 */
1357
	public $name = 'Dependency';
1358
}
1359
 
1360
/**
1361
 * ModelA class
1362
 *
1363
 * @package       Cake.Test.Case.Model
1364
 */
1365
class ModelA extends CakeTestModel {
1366
 
1367
/**
1368
 * name property
1369
 *
1370
 * @var string
1371
 */
1372
	public $name = 'ModelA';
1373
 
1374
/**
1375
 * useTable property
1376
 *
1377
 * @var string
1378
 */
1379
	public $useTable = 'apples';
1380
 
1381
/**
1382
 * hasMany property
1383
 *
1384
 * @var array
1385
 */
1386
	public $hasMany = array('ModelB', 'ModelC');
1387
}
1388
 
1389
/**
1390
 * ModelB class
1391
 *
1392
 * @package       Cake.Test.Case.Model
1393
 */
1394
class ModelB extends CakeTestModel {
1395
 
1396
/**
1397
 * name property
1398
 *
1399
 * @var string
1400
 */
1401
	public $name = 'ModelB';
1402
 
1403
/**
1404
 * useTable property
1405
 *
1406
 * @var string
1407
 */
1408
	public $useTable = 'messages';
1409
 
1410
/**
1411
 * hasMany property
1412
 *
1413
 * @var array
1414
 */
1415
	public $hasMany = array('ModelD');
1416
}
1417
 
1418
/**
1419
 * ModelC class
1420
 *
1421
 * @package       Cake.Test.Case.Model
1422
 */
1423
class ModelC extends CakeTestModel {
1424
 
1425
/**
1426
 * name property
1427
 *
1428
 * @var string
1429
 */
1430
	public $name = 'ModelC';
1431
 
1432
/**
1433
 * useTable property
1434
 *
1435
 * @var string
1436
 */
1437
	public $useTable = 'bids';
1438
 
1439
/**
1440
 * hasMany property
1441
 *
1442
 * @var array
1443
 */
1444
	public $hasMany = array('ModelD');
1445
}
1446
 
1447
/**
1448
 * ModelD class
1449
 *
1450
 * @package       Cake.Test.Case.Model
1451
 */
1452
class ModelD extends CakeTestModel {
1453
 
1454
/**
1455
 * name property
1456
 *
1457
 * @var string
1458
 */
1459
	public $name = 'ModelD';
1460
 
1461
/**
1462
 * useTable property
1463
 *
1464
 * @var string
1465
 */
1466
	public $useTable = 'threads';
1467
}
1468
 
1469
/**
1470
 * Something class
1471
 *
1472
 * @package       Cake.Test.Case.Model
1473
 */
1474
class Something extends CakeTestModel {
1475
 
1476
/**
1477
 * name property
1478
 *
1479
 * @var string
1480
 */
1481
	public $name = 'Something';
1482
 
1483
/**
1484
 * hasAndBelongsToMany property
1485
 *
1486
 * @var array
1487
 */
1488
	public $hasAndBelongsToMany = array('SomethingElse' => array('with' => array('JoinThing' => array('doomed'))));
1489
}
1490
 
1491
/**
1492
 * SomethingElse class
1493
 *
1494
 * @package       Cake.Test.Case.Model
1495
 */
1496
class SomethingElse extends CakeTestModel {
1497
 
1498
/**
1499
 * name property
1500
 *
1501
 * @var string
1502
 */
1503
	public $name = 'SomethingElse';
1504
 
1505
/**
1506
 * hasAndBelongsToMany property
1507
 *
1508
 * @var array
1509
 */
1510
	public $hasAndBelongsToMany = array('Something' => array('with' => 'JoinThing'));
1511
 
1512
/**
1513
 * afterFind callBack
1514
 *
1515
 * @param array $results
1516
 * @param bool $primary
1517
 * @return array
1518
 */
1519
	public function afterFind($results, $primary = false) {
1520
		foreach ($results as $key => $result) {
1521
			if (!empty($result[$this->alias]) && is_array($result[$this->alias])) {
1522
				$results[$key][$this->alias]['afterFind'] = 'Successfully added by AfterFind';
1523
			}
1524
		}
1525
		return $results;
1526
	}
1527
 
1528
}
1529
 
1530
/**
1531
 * JoinThing class
1532
 *
1533
 * @package       Cake.Test.Case.Model
1534
 */
1535
class JoinThing extends CakeTestModel {
1536
 
1537
/**
1538
 * name property
1539
 *
1540
 * @var string
1541
 */
1542
	public $name = 'JoinThing';
1543
 
1544
/**
1545
 * belongsTo property
1546
 *
1547
 * @var array
1548
 */
1549
	public $belongsTo = array('Something', 'SomethingElse');
1550
 
1551
/**
1552
 * afterFind callBack
1553
 *
1554
 * @param array $results
1555
 * @param bool $primary
1556
 * @return array
1557
 */
1558
	public function afterFind($results, $primary = false) {
1559
		foreach ($results as $key => $result) {
1560
			if (!empty($result[$this->alias]) && is_array($result[$this->alias])) {
1561
				$results[$key][$this->alias]['afterFind'] = 'Successfully added by AfterFind';
1562
			}
1563
		}
1564
		return $results;
1565
	}
1566
 
1567
}
1568
 
1569
/**
1570
 * Portfolio class
1571
 *
1572
 * @package       Cake.Test.Case.Model
1573
 */
1574
class Portfolio extends CakeTestModel {
1575
 
1576
/**
1577
 * name property
1578
 *
1579
 * @var string
1580
 */
1581
	public $name = 'Portfolio';
1582
 
1583
/**
1584
 * hasAndBelongsToMany property
1585
 *
1586
 * @var array
1587
 */
1588
	public $hasAndBelongsToMany = array('Item');
1589
}
1590
 
1591
/**
1592
 * Item class
1593
 *
1594
 * @package       Cake.Test.Case.Model
1595
 */
1596
class Item extends CakeTestModel {
1597
 
1598
/**
1599
 * name property
1600
 *
1601
 * @var string
1602
 */
1603
	public $name = 'Item';
1604
 
1605
/**
1606
 * belongsTo property
1607
 *
1608
 * @var array
1609
 */
1610
	public $belongsTo = array('Syfile' => array('counterCache' => true));
1611
 
1612
/**
1613
 * hasAndBelongsToMany property
1614
 *
1615
 * @var array
1616
 */
1617
	public $hasAndBelongsToMany = array('Portfolio' => array('unique' => false));
1618
}
1619
 
1620
/**
1621
 * ItemsPortfolio class
1622
 *
1623
 * @package       Cake.Test.Case.Model
1624
 */
1625
class ItemsPortfolio extends CakeTestModel {
1626
 
1627
/**
1628
 * name property
1629
 *
1630
 * @var string
1631
 */
1632
	public $name = 'ItemsPortfolio';
1633
}
1634
 
1635
/**
1636
 * Syfile class
1637
 *
1638
 * @package       Cake.Test.Case.Model
1639
 */
1640
class Syfile extends CakeTestModel {
1641
 
1642
/**
1643
 * name property
1644
 *
1645
 * @var string
1646
 */
1647
	public $name = 'Syfile';
1648
 
1649
/**
1650
 * belongsTo property
1651
 *
1652
 * @var array
1653
 */
1654
	public $belongsTo = array('Image');
1655
}
1656
 
1657
/**
1658
 * Image class
1659
 *
1660
 * @package       Cake.Test.Case.Model
1661
 */
1662
class Image extends CakeTestModel {
1663
 
1664
/**
1665
 * name property
1666
 *
1667
 * @var string
1668
 */
1669
	public $name = 'Image';
1670
}
1671
 
1672
/**
1673
 * DeviceType class
1674
 *
1675
 * @package       Cake.Test.Case.Model
1676
 */
1677
class DeviceType extends CakeTestModel {
1678
 
1679
/**
1680
 * name property
1681
 *
1682
 * @var string
1683
 */
1684
	public $name = 'DeviceType';
1685
 
1686
/**
1687
 * order property
1688
 *
1689
 * @var array
1690
 */
1691
	public $order = array('DeviceType.order' => 'ASC');
1692
 
1693
/**
1694
 * belongsTo property
1695
 *
1696
 * @var array
1697
 */
1698
	public $belongsTo = array(
1699
		'DeviceTypeCategory', 'FeatureSet', 'ExteriorTypeCategory',
1700
		'Image' => array('className' => 'Document'),
1701
		'Extra1' => array('className' => 'Document'),
1702
		'Extra2' => array('className' => 'Document'));
1703
 
1704
/**
1705
 * hasMany property
1706
 *
1707
 * @var array
1708
 */
1709
	public $hasMany = array('Device' => array('order' => array('Device.id' => 'ASC')));
1710
}
1711
 
1712
/**
1713
 * DeviceTypeCategory class
1714
 *
1715
 * @package       Cake.Test.Case.Model
1716
 */
1717
class DeviceTypeCategory extends CakeTestModel {
1718
 
1719
/**
1720
 * name property
1721
 *
1722
 * @var string
1723
 */
1724
	public $name = 'DeviceTypeCategory';
1725
}
1726
 
1727
/**
1728
 * FeatureSet class
1729
 *
1730
 * @package       Cake.Test.Case.Model
1731
 */
1732
class FeatureSet extends CakeTestModel {
1733
 
1734
/**
1735
 * name property
1736
 *
1737
 * @var string
1738
 */
1739
	public $name = 'FeatureSet';
1740
}
1741
 
1742
/**
1743
 * ExteriorTypeCategory class
1744
 *
1745
 * @package       Cake.Test.Case.Model
1746
 */
1747
class ExteriorTypeCategory extends CakeTestModel {
1748
 
1749
/**
1750
 * name property
1751
 *
1752
 * @var string
1753
 */
1754
	public $name = 'ExteriorTypeCategory';
1755
 
1756
/**
1757
 * belongsTo property
1758
 *
1759
 * @var array
1760
 */
1761
	public $belongsTo = array('Image' => array('className' => 'Device'));
1762
}
1763
 
1764
/**
1765
 * Document class
1766
 *
1767
 * @package       Cake.Test.Case.Model
1768
 */
1769
class Document extends CakeTestModel {
1770
 
1771
/**
1772
 * name property
1773
 *
1774
 * @var string
1775
 */
1776
	public $name = 'Document';
1777
 
1778
/**
1779
 * belongsTo property
1780
 *
1781
 * @var array
1782
 */
1783
	public $belongsTo = array('DocumentDirectory');
1784
}
1785
 
1786
/**
1787
 * Device class
1788
 *
1789
 * @package       Cake.Test.Case.Model
1790
 */
1791
class Device extends CakeTestModel {
1792
 
1793
/**
1794
 * name property
1795
 *
1796
 * @var string
1797
 */
1798
	public $name = 'Device';
1799
}
1800
 
1801
/**
1802
 * DocumentDirectory class
1803
 *
1804
 * @package       Cake.Test.Case.Model
1805
 */
1806
class DocumentDirectory extends CakeTestModel {
1807
 
1808
/**
1809
 * name property
1810
 *
1811
 * @var string
1812
 */
1813
	public $name = 'DocumentDirectory';
1814
}
1815
 
1816
/**
1817
 * PrimaryModel class
1818
 *
1819
 * @package       Cake.Test.Case.Model
1820
 */
1821
class PrimaryModel extends CakeTestModel {
1822
 
1823
/**
1824
 * name property
1825
 *
1826
 * @var string
1827
 */
1828
	public $name = 'PrimaryModel';
1829
}
1830
 
1831
/**
1832
 * SecondaryModel class
1833
 *
1834
 * @package       Cake.Test.Case.Model
1835
 */
1836
class SecondaryModel extends CakeTestModel {
1837
 
1838
/**
1839
 * name property
1840
 *
1841
 * @var string
1842
 */
1843
	public $name = 'SecondaryModel';
1844
}
1845
 
1846
/**
1847
 * JoinA class
1848
 *
1849
 * @package       Cake.Test.Case.Model
1850
 */
1851
class JoinA extends CakeTestModel {
1852
 
1853
/**
1854
 * name property
1855
 *
1856
 * @var string
1857
 */
1858
	public $name = 'JoinA';
1859
 
1860
/**
1861
 * hasAndBelongsToMany property
1862
 *
1863
 * @var array
1864
 */
1865
	public $hasAndBelongsToMany = array('JoinB', 'JoinC');
1866
}
1867
 
1868
/**
1869
 * JoinB class
1870
 *
1871
 * @package       Cake.Test.Case.Model
1872
 */
1873
class JoinB extends CakeTestModel {
1874
 
1875
/**
1876
 * name property
1877
 *
1878
 * @var string
1879
 */
1880
	public $name = 'JoinB';
1881
 
1882
/**
1883
 * hasAndBelongsToMany property
1884
 *
1885
 * @var array
1886
 */
1887
	public $hasAndBelongsToMany = array('JoinA');
1888
}
1889
 
1890
/**
1891
 * JoinC class
1892
 *
1893
 * @package       Cake.Test.Case.Model
1894
 */
1895
class JoinC extends CakeTestModel {
1896
 
1897
/**
1898
 * name property
1899
 *
1900
 * @var string
1901
 */
1902
	public $name = 'JoinC';
1903
 
1904
/**
1905
 * hasAndBelongsToMany property
1906
 *
1907
 * @var array
1908
 */
1909
	public $hasAndBelongsToMany = array('JoinA');
1910
}
1911
 
1912
/**
1913
 * ThePaper class
1914
 *
1915
 * @package       Cake.Test.Case.Model
1916
 */
1917
class ThePaper extends CakeTestModel {
1918
 
1919
/**
1920
 * name property
1921
 *
1922
 * @var string
1923
 */
1924
	public $name = 'ThePaper';
1925
 
1926
/**
1927
 * useTable property
1928
 *
1929
 * @var string
1930
 */
1931
	public $useTable = 'apples';
1932
 
1933
/**
1934
 * hasOne property
1935
 *
1936
 * @var array
1937
 */
1938
	public $hasOne = array('Itself' => array('className' => 'ThePaper', 'foreignKey' => 'apple_id'));
1939
 
1940
/**
1941
 * hasAndBelongsToMany property
1942
 *
1943
 * @var array
1944
 */
1945
	public $hasAndBelongsToMany = array('Monkey' => array('joinTable' => 'the_paper_monkies', 'order' => 'id'));
1946
}
1947
 
1948
/**
1949
 * Monkey class
1950
 *
1951
 * @package       Cake.Test.Case.Model
1952
 */
1953
class Monkey extends CakeTestModel {
1954
 
1955
/**
1956
 * name property
1957
 *
1958
 * @var string
1959
 */
1960
	public $name = 'Monkey';
1961
 
1962
/**
1963
 * useTable property
1964
 *
1965
 * @var string
1966
 */
1967
	public $useTable = 'devices';
1968
}
1969
 
1970
/**
1971
 * AssociationTest1 class
1972
 *
1973
 * @package       Cake.Test.Case.Model
1974
 */
1975
class AssociationTest1 extends CakeTestModel {
1976
 
1977
/**
1978
 * useTable property
1979
 *
1980
 * @var string
1981
 */
1982
	public $useTable = 'join_as';
1983
 
1984
/**
1985
 * name property
1986
 *
1987
 * @var string
1988
 */
1989
	public $name = 'AssociationTest1';
1990
 
1991
/**
1992
 * hasAndBelongsToMany property
1993
 *
1994
 * @var array
1995
 */
1996
	public $hasAndBelongsToMany = array('AssociationTest2' => array(
1997
		'unique' => false, 'joinTable' => 'join_as_join_bs', 'foreignKey' => false
1998
	));
1999
}
2000
 
2001
/**
2002
 * AssociationTest2 class
2003
 *
2004
 * @package       Cake.Test.Case.Model
2005
 */
2006
class AssociationTest2 extends CakeTestModel {
2007
 
2008
/**
2009
 * useTable property
2010
 *
2011
 * @var string
2012
 */
2013
	public $useTable = 'join_bs';
2014
 
2015
/**
2016
 * name property
2017
 *
2018
 * @var string
2019
 */
2020
	public $name = 'AssociationTest2';
2021
 
2022
/**
2023
 * hasAndBelongsToMany property
2024
 *
2025
 * @var array
2026
 */
2027
	public $hasAndBelongsToMany = array('AssociationTest1' => array(
2028
		'unique' => false, 'joinTable' => 'join_as_join_bs'
2029
	));
2030
}
2031
 
2032
/**
2033
 * Callback class
2034
 *
2035
 * @package       Cake.Test.Case.Model
2036
 */
2037
class Callback extends CakeTestModel {
2038
 
2039
}
2040
 
2041
/**
2042
 * CallbackPostTestModel class
2043
 *
2044
 * @package       Cake.Test.Case.Model
2045
 */
2046
class CallbackPostTestModel extends CakeTestModel {
2047
 
2048
	public $useTable = 'posts';
2049
 
2050
/**
2051
 * variable to control return of beforeValidate
2052
 *
2053
 * @var bool
2054
 */
2055
	public $beforeValidateReturn = true;
2056
 
2057
/**
2058
 * variable to control return of beforeSave
2059
 *
2060
 * @var bool
2061
 */
2062
	public $beforeSaveReturn = true;
2063
 
2064
/**
2065
 * variable to control return of beforeDelete
2066
 *
2067
 * @var bool
2068
 */
2069
	public $beforeDeleteReturn = true;
2070
 
2071
/**
2072
 * beforeSave callback
2073
 *
2074
 * @return bool
2075
 */
2076
	public function beforeSave($options = array()) {
2077
		return $this->beforeSaveReturn;
2078
	}
2079
 
2080
/**
2081
 * beforeValidate callback
2082
 *
2083
 * @param array $options Options passed from Model::save().
2084
 * @return bool True if validate operation should continue, false to abort
2085
 * @see Model::save()
2086
 */
2087
	public function beforeValidate($options = array()) {
2088
		return $this->beforeValidateReturn;
2089
	}
2090
 
2091
/**
2092
 * beforeDelete callback
2093
 *
2094
 * @return bool
2095
 */
2096
	public function beforeDelete($cascade = true) {
2097
		return $this->beforeDeleteReturn;
2098
	}
2099
 
2100
}
2101
 
2102
/**
2103
 * Uuid class
2104
 *
2105
 * @package       Cake.Test.Case.Model
2106
 */
2107
class Uuid extends CakeTestModel {
2108
 
2109
/**
2110
 * name property
2111
 *
2112
 * @var string
2113
 */
2114
	public $name = 'Uuid';
2115
}
2116
 
2117
/**
2118
 * DataTest class
2119
 *
2120
 * @package       Cake.Test.Case.Model
2121
 */
2122
class DataTest extends CakeTestModel {
2123
 
2124
/**
2125
 * name property
2126
 *
2127
 * @var string
2128
 */
2129
	public $name = 'DataTest';
2130
}
2131
 
2132
/**
2133
 * TheVoid class
2134
 *
2135
 * @package       Cake.Test.Case.Model
2136
 */
2137
class TheVoid extends CakeTestModel {
2138
 
2139
/**
2140
 * name property
2141
 *
2142
 * @var string
2143
 */
2144
	public $name = 'TheVoid';
2145
 
2146
/**
2147
 * useTable property
2148
 *
2149
 * @var bool
2150
 */
2151
	public $useTable = false;
2152
}
2153
 
2154
/**
2155
 * ValidationTest1 class
2156
 *
2157
 * @package       Cake.Test.Case.Model
2158
 */
2159
class ValidationTest1 extends CakeTestModel {
2160
 
2161
/**
2162
 * name property
2163
 *
2164
 * @var string
2165
 */
2166
	public $name = 'ValidationTest1';
2167
 
2168
/**
2169
 * useTable property
2170
 *
2171
 * @var bool
2172
 */
2173
	public $useTable = false;
2174
 
2175
/**
2176
 * schema property
2177
 *
2178
 * @var array
2179
 */
2180
	protected $_schema = array();
2181
 
2182
/**
2183
 * validate property
2184
 *
2185
 * @var array
2186
 */
2187
	public $validate = array(
2188
		'title' => 'notEmpty',
2189
		'published' => 'customValidationMethod',
2190
		'body' => array(
2191
			'notEmpty',
2192
			'/^.{5,}$/s' => 'no matchy',
2193
			'/^[0-9A-Za-z \\.]{1,}$/s'
2194
		)
2195
	);
2196
 
2197
/**
2198
 * customValidationMethod method
2199
 *
2200
 * @param mixed $data
2201
 * @return void
2202
 */
2203
	public function customValidationMethod($data) {
2204
		return $data === 1;
2205
	}
2206
 
2207
/**
2208
 * Custom validator with parameters + default values
2209
 *
2210
 * @return array
2211
 */
2212
	public function customValidatorWithParams($data, $validator, $or = true, $ignoreOnSame = 'id') {
2213
		$this->validatorParams = get_defined_vars();
2214
		unset($this->validatorParams['this']);
2215
		return true;
2216
	}
2217
 
2218
/**
2219
 * Custom validator with message
2220
 *
2221
 * @return array
2222
 */
2223
	public function customValidatorWithMessage($data) {
2224
		return 'This field will *never* validate! Muhahaha!';
2225
	}
2226
 
2227
/**
2228
 * Test validation with many parameters
2229
 *
2230
 * @return void
2231
 */
2232
	public function customValidatorWithSixParams($data, $one = 1, $two = 2, $three = 3, $four = 4, $five = 5, $six = 6) {
2233
		$this->validatorParams = get_defined_vars();
2234
		unset($this->validatorParams['this']);
2235
		return true;
2236
	}
2237
 
2238
}
2239
 
2240
/**
2241
 * ValidationTest2 class
2242
 *
2243
 * @package       Cake.Test.Case.Model
2244
 */
2245
class ValidationTest2 extends CakeTestModel {
2246
 
2247
/**
2248
 * name property
2249
 *
2250
 * @var string
2251
 */
2252
	public $name = 'ValidationTest2';
2253
 
2254
/**
2255
 * useTable property
2256
 *
2257
 * @var bool
2258
 */
2259
	public $useTable = false;
2260
 
2261
/**
2262
 * validate property
2263
 *
2264
 * @var array
2265
 */
2266
	public $validate = array(
2267
		'title' => 'notEmpty',
2268
		'published' => 'customValidationMethod',
2269
		'body' => array(
2270
			'notEmpty',
2271
			'/^.{5,}$/s' => 'no matchy',
2272
			'/^[0-9A-Za-z \\.]{1,}$/s'
2273
		)
2274
	);
2275
 
2276
/**
2277
 * customValidationMethod method
2278
 *
2279
 * @param mixed $data
2280
 * @return void
2281
 */
2282
	public function customValidationMethod($data) {
2283
		return $data === 1;
2284
	}
2285
 
2286
/**
2287
 * schema method
2288
 *
2289
 * @return void
2290
 */
2291
	public function schema($field = false) {
2292
		return array();
2293
	}
2294
 
2295
}
2296
 
2297
/**
2298
 * Person class
2299
 *
2300
 * @package       Cake.Test.Case.Model
2301
 */
2302
class Person extends CakeTestModel {
2303
 
2304
/**
2305
 * name property
2306
 *
2307
 * @var string
2308
 */
2309
	public $name = 'Person';
2310
 
2311
/**
2312
 * belongsTo property
2313
 *
2314
 * @var array
2315
 */
2316
	public $belongsTo = array(
2317
		'Mother' => array(
2318
			'className' => 'Person',
2319
			'foreignKey' => 'mother_id'
2320
		),
2321
		'Father' => array(
2322
			'className' => 'Person',
2323
			'foreignKey' => 'father_id'
2324
		)
2325
	);
2326
}
2327
 
2328
/**
2329
 * UnderscoreField class
2330
 *
2331
 * @package       Cake.Test.Case.Model
2332
 */
2333
class UnderscoreField extends CakeTestModel {
2334
 
2335
/**
2336
 * name property
2337
 *
2338
 * @var string
2339
 */
2340
	public $name = 'UnderscoreField';
2341
}
2342
 
2343
/**
2344
 * Product class
2345
 *
2346
 * @package       Cake.Test.Case.Model
2347
 */
2348
class Product extends CakeTestModel {
2349
 
2350
/**
2351
 * name property
2352
 *
2353
 * @var string
2354
 */
2355
	public $name = 'Product';
2356
}
2357
 
2358
/**
2359
 * Story class
2360
 *
2361
 * @package       Cake.Test.Case.Model
2362
 */
2363
class Story extends CakeTestModel {
2364
 
2365
/**
2366
 * name property
2367
 *
2368
 * @var string
2369
 */
2370
	public $name = 'Story';
2371
 
2372
/**
2373
 * primaryKey property
2374
 *
2375
 * @var string
2376
 */
2377
	public $primaryKey = 'story';
2378
 
2379
/**
2380
 * hasAndBelongsToMany property
2381
 *
2382
 * @var array
2383
 */
2384
	public $hasAndBelongsToMany = array('Tag' => array('foreignKey' => 'story'));
2385
 
2386
/**
2387
 * validate property
2388
 *
2389
 * @var array
2390
 */
2391
	public $validate = array('title' => 'notEmpty');
2392
}
2393
 
2394
/**
2395
 * Cd class
2396
 *
2397
 * @package       Cake.Test.Case.Model
2398
 */
2399
class Cd extends CakeTestModel {
2400
 
2401
/**
2402
 * name property
2403
 *
2404
 * @var string
2405
 */
2406
	public $name = 'Cd';
2407
 
2408
/**
2409
 * hasOne property
2410
 *
2411
 * @var array
2412
 */
2413
	public $hasOne = array(
2414
		'OverallFavorite' => array(
2415
			'foreignKey' => 'model_id',
2416
			'dependent' => true,
2417
			'conditions' => array('model_type' => 'Cd')
2418
		)
2419
	);
2420
 
2421
}
2422
 
2423
/**
2424
 * Book class
2425
 *
2426
 * @package       Cake.Test.Case.Model
2427
 */
2428
class Book extends CakeTestModel {
2429
 
2430
/**
2431
 * name property
2432
 *
2433
 * @var string
2434
 */
2435
	public $name = 'Book';
2436
 
2437
/**
2438
 * hasOne property
2439
 *
2440
 * @var array
2441
 */
2442
	public $hasOne = array(
2443
		'OverallFavorite' => array(
2444
			'foreignKey' => 'model_id',
2445
			'dependent' => true,
2446
			'conditions' => 'OverallFavorite.model_type = \'Book\''
2447
		)
2448
	);
2449
 
2450
}
2451
 
2452
/**
2453
 * OverallFavorite class
2454
 *
2455
 * @package       Cake.Test.Case.Model
2456
 */
2457
class OverallFavorite extends CakeTestModel {
2458
 
2459
/**
2460
 * name property
2461
 *
2462
 * @var string
2463
 */
2464
	public $name = 'OverallFavorite';
2465
}
2466
 
2467
/**
2468
 * MyUser class
2469
 *
2470
 * @package       Cake.Test.Case.Model
2471
 */
2472
class MyUser extends CakeTestModel {
2473
 
2474
/**
2475
 * name property
2476
 *
2477
 * @var string
2478
 */
2479
	public $name = 'MyUser';
2480
 
2481
/**
2482
 * undocumented variable
2483
 *
2484
 * @var string
2485
 */
2486
	public $hasAndBelongsToMany = array('MyCategory');
2487
}
2488
 
2489
/**
2490
 * MyCategory class
2491
 *
2492
 * @package       Cake.Test.Case.Model
2493
 */
2494
class MyCategory extends CakeTestModel {
2495
 
2496
/**
2497
 * name property
2498
 *
2499
 * @var string
2500
 */
2501
	public $name = 'MyCategory';
2502
 
2503
/**
2504
 * undocumented variable
2505
 *
2506
 * @var string
2507
 */
2508
	public $hasAndBelongsToMany = array('MyProduct', 'MyUser');
2509
}
2510
 
2511
/**
2512
 * MyProduct class
2513
 *
2514
 * @package       Cake.Test.Case.Model
2515
 */
2516
class MyProduct extends CakeTestModel {
2517
 
2518
/**
2519
 * name property
2520
 *
2521
 * @var string
2522
 */
2523
	public $name = 'MyProduct';
2524
 
2525
/**
2526
 * undocumented variable
2527
 *
2528
 * @var string
2529
 */
2530
	public $hasAndBelongsToMany = array('MyCategory');
2531
}
2532
 
2533
/**
2534
 * MyCategoriesMyUser class
2535
 *
2536
 * @package       Cake.Test.Case.Model
2537
 */
2538
class MyCategoriesMyUser extends CakeTestModel {
2539
 
2540
/**
2541
 * name property
2542
 *
2543
 * @var string
2544
 */
2545
	public $name = 'MyCategoriesMyUser';
2546
}
2547
 
2548
/**
2549
 * MyCategoriesMyProduct class
2550
 *
2551
 * @package       Cake.Test.Case.Model
2552
 */
2553
class MyCategoriesMyProduct extends CakeTestModel {
2554
 
2555
/**
2556
 * name property
2557
 *
2558
 * @var string
2559
 */
2560
	public $name = 'MyCategoriesMyProduct';
2561
}
2562
 
2563
/**
2564
 * NumberTree class
2565
 *
2566
 * @package       Cake.Test.Case.Model
2567
 */
2568
class NumberTree extends CakeTestModel {
2569
 
2570
/**
2571
 * name property
2572
 *
2573
 * @var string
2574
 */
2575
	public $name = 'NumberTree';
2576
 
2577
/**
2578
 * actsAs property
2579
 *
2580
 * @var array
2581
 */
2582
	public $actsAs = array('Tree');
2583
 
2584
/**
2585
 * initialize method
2586
 *
2587
 * @param int $levelLimit
2588
 * @param int $childLimit
2589
 * @param mixed $currentLevel
2590
 * @param mixed $parent_id
2591
 * @param string $prefix
2592
 * @param bool $hierarchal
2593
 * @return void
2594
 */
2595
	public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierarchal = true) {
2596
		if (!$parentId) {
2597
			$db = ConnectionManager::getDataSource($this->useDbConfig);
2598
			$db->truncate($this->table);
2599
			$this->save(array($this->name => array('name' => '1. Root')));
2600
			$this->initialize($levelLimit, $childLimit, 1, $this->id, '1', $hierarchal);
2601
			$this->create(array());
2602
		}
2603
 
2604
		if (!$currentLevel || $currentLevel > $levelLimit) {
2605
			return;
2606
		}
2607
 
2608
		for ($i = 1; $i <= $childLimit; $i++) {
2609
			$name = $prefix . '.' . $i;
2610
			$data = array($this->name => array('name' => $name));
2611
			$this->create($data);
2612
 
2613
			if ($hierarchal) {
2614
				if ($this->name === 'UnconventionalTree') {
2615
					$data[$this->name]['join'] = $parentId;
2616
				} else {
2617
					$data[$this->name]['parent_id'] = $parentId;
2618
				}
2619
			}
2620
			$this->save($data);
2621
			$this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierarchal);
2622
		}
2623
	}
2624
 
2625
}
2626
 
2627
/**
2628
 * NumberTreeTwo class
2629
 *
2630
 * @package       Cake.Test.Case.Model
2631
 */
2632
class NumberTreeTwo extends NumberTree {
2633
 
2634
/**
2635
 * name property
2636
 *
2637
 * @var string
2638
 */
2639
	public $name = 'NumberTreeTwo';
2640
 
2641
/**
2642
 * actsAs property
2643
 *
2644
 * @var array
2645
 */
2646
	public $actsAs = array();
2647
}
2648
 
2649
/**
2650
 * FlagTree class
2651
 *
2652
 * @package       Cake.Test.Case.Model
2653
 */
2654
class FlagTree extends NumberTree {
2655
 
2656
/**
2657
 * name property
2658
 *
2659
 * @var string
2660
 */
2661
	public $name = 'FlagTree';
2662
}
2663
 
2664
/**
2665
 * UnconventionalTree class
2666
 *
2667
 * @package       Cake.Test.Case.Model
2668
 */
2669
class UnconventionalTree extends NumberTree {
2670
 
2671
/**
2672
 * name property
2673
 *
2674
 * @var string
2675
 */
2676
	public $name = 'UnconventionalTree';
2677
 
2678
	public $actsAs = array(
2679
		'Tree' => array(
2680
			'parent' => 'join',
2681
			'left' => 'left',
2682
			'right' => 'right'
2683
		)
2684
	);
2685
 
2686
}
2687
 
2688
/**
2689
 * UuidTree class
2690
 *
2691
 * @package       Cake.Test.Case.Model
2692
 */
2693
class UuidTree extends NumberTree {
2694
 
2695
/**
2696
 * name property
2697
 *
2698
 * @var string
2699
 */
2700
	public $name = 'UuidTree';
2701
}
2702
 
2703
/**
2704
 * Campaign class
2705
 *
2706
 * @package       Cake.Test.Case.Model
2707
 */
2708
class Campaign extends CakeTestModel {
2709
 
2710
/**
2711
 * name property
2712
 *
2713
 * @var string
2714
 */
2715
	public $name = 'Campaign';
2716
 
2717
/**
2718
 * hasMany property
2719
 *
2720
 * @var array
2721
 */
2722
	public $hasMany = array('Ad' => array('fields' => array('id', 'campaign_id', 'name')));
2723
}
2724
 
2725
/**
2726
 * Ad class
2727
 *
2728
 * @package       Cake.Test.Case.Model
2729
 */
2730
class Ad extends CakeTestModel {
2731
 
2732
/**
2733
 * name property
2734
 *
2735
 * @var string
2736
 */
2737
	public $name = 'Ad';
2738
 
2739
/**
2740
 * actsAs property
2741
 *
2742
 * @var array
2743
 */
2744
	public $actsAs = array('Tree');
2745
 
2746
/**
2747
 * belongsTo property
2748
 *
2749
 * @var array
2750
 */
2751
	public $belongsTo = array('Campaign');
2752
}
2753
 
2754
/**
2755
 * AfterTree class
2756
 *
2757
 * @package       Cake.Test.Case.Model
2758
 */
2759
class AfterTree extends NumberTree {
2760
 
2761
/**
2762
 * name property
2763
 *
2764
 * @var string
2765
 */
2766
	public $name = 'AfterTree';
2767
 
2768
/**
2769
 * actsAs property
2770
 *
2771
 * @var array
2772
 */
2773
	public $actsAs = array('Tree');
2774
 
2775
/**
2776
 * @param bool $created
2777
 * @param array $options
2778
 * @return void
2779
 */
2780
	public function afterSave($created, $options = array()) {
2781
		if ($created && isset($this->data['AfterTree'])) {
2782
			$this->data['AfterTree']['name'] = 'Six and One Half Changed in AfterTree::afterSave() but not in database';
2783
		}
2784
	}
2785
 
2786
}
2787
 
2788
/**
2789
 * Nonconformant Content class
2790
 *
2791
 * @package       Cake.Test.Case.Model
2792
 */
2793
class Content extends CakeTestModel {
2794
 
2795
/**
2796
 * name property
2797
 *
2798
 * @var string
2799
 */
2800
	public $name = 'Content';
2801
 
2802
/**
2803
 * useTable property
2804
 *
2805
 * @var string
2806
 */
2807
	public $useTable = 'Content';
2808
 
2809
/**
2810
 * primaryKey property
2811
 *
2812
 * @var string
2813
 */
2814
	public $primaryKey = 'iContentId';
2815
 
2816
/**
2817
 * hasAndBelongsToMany property
2818
 *
2819
 * @var array
2820
 */
2821
	public $hasAndBelongsToMany = array('Account' => array('className' => 'Account', 'with' => 'ContentAccount', 'joinTable' => 'ContentAccounts', 'foreignKey' => 'iContentId', 'associationForeignKey', 'iAccountId'));
2822
}
2823
 
2824
/**
2825
 * Nonconformant Account class
2826
 *
2827
 * @package       Cake.Test.Case.Model
2828
 */
2829
class Account extends CakeTestModel {
2830
 
2831
/**
2832
 * name property
2833
 *
2834
 * @var string
2835
 */
2836
	public $name = 'Account';
2837
 
2838
/**
2839
 * useTable property
2840
 *
2841
 * @var string
2842
 */
2843
	public $useTable = 'Accounts';
2844
 
2845
/**
2846
 * primaryKey property
2847
 *
2848
 * @var string
2849
 */
2850
	public $primaryKey = 'iAccountId';
2851
}
2852
 
2853
/**
2854
 * Nonconformant ContentAccount class
2855
 *
2856
 * @package       Cake.Test.Case.Model
2857
 */
2858
class ContentAccount extends CakeTestModel {
2859
 
2860
/**
2861
 * name property
2862
 *
2863
 * @var string
2864
 */
2865
	public $name = 'ContentAccount';
2866
 
2867
/**
2868
 * useTable property
2869
 *
2870
 * @var string
2871
 */
2872
	public $useTable = 'ContentAccounts';
2873
 
2874
/**
2875
 * primaryKey property
2876
 *
2877
 * @var string
2878
 */
2879
	public $primaryKey = 'iContentAccountsId';
2880
}
2881
 
2882
/**
2883
 * FilmFile class
2884
 *
2885
 * @package       Cake.Test.Case.Model
2886
 */
2887
class FilmFile extends CakeTestModel {
2888
 
2889
	public $name = 'FilmFile';
2890
 
2891
}
2892
 
2893
/**
2894
 * Basket test model
2895
 *
2896
 * @package       Cake.Test.Case.Model
2897
 */
2898
class Basket extends CakeTestModel {
2899
 
2900
	public $name = 'Basket';
2901
 
2902
	public $belongsTo = array(
2903
		'FilmFile' => array(
2904
			'className' => 'FilmFile',
2905
			'foreignKey' => 'object_id',
2906
			'conditions' => "Basket.type = 'file'",
2907
			'fields' => '',
2908
			'order' => ''
2909
		)
2910
	);
2911
 
2912
}
2913
 
2914
/**
2915
 * TestPluginArticle class
2916
 *
2917
 * @package       Cake.Test.Case.Model
2918
 */
2919
class TestPluginArticle extends CakeTestModel {
2920
 
2921
/**
2922
 * name property
2923
 *
2924
 * @var string
2925
 */
2926
	public $name = 'TestPluginArticle';
2927
 
2928
/**
2929
 * belongsTo property
2930
 *
2931
 * @var array
2932
 */
2933
	public $belongsTo = array('User');
2934
 
2935
/**
2936
 * hasMany property
2937
 *
2938
 * @var array
2939
 */
2940
	public $hasMany = array(
2941
		'TestPluginComment' => array(
2942
			'className' => 'TestPlugin.TestPluginComment',
2943
			'foreignKey' => 'article_id',
2944
			'dependent' => true
2945
		)
2946
	);
2947
}
2948
 
2949
/**
2950
 * TestPluginComment class
2951
 *
2952
 * @package       Cake.Test.Case.Model
2953
 */
2954
class TestPluginComment extends CakeTestModel {
2955
 
2956
/**
2957
 * name property
2958
 *
2959
 * @var string
2960
 */
2961
	public $name = 'TestPluginComment';
2962
 
2963
/**
2964
 * belongsTo property
2965
 *
2966
 * @var array
2967
 */
2968
	public $belongsTo = array(
2969
		'TestPluginArticle' => array(
2970
			'className' => 'TestPlugin.TestPluginArticle',
2971
			'foreignKey' => 'article_id',
2972
		),
2973
		'TestPlugin.User'
2974
	);
2975
}
2976
 
2977
/**
2978
 * Uuidportfolio class
2979
 *
2980
 * @package       Cake.Test.Case.Model
2981
 */
2982
class Uuidportfolio extends CakeTestModel {
2983
 
2984
/**
2985
 * name property
2986
 *
2987
 * @var string
2988
 */
2989
	public $name = 'Uuidportfolio';
2990
 
2991
/**
2992
 * hasAndBelongsToMany property
2993
 *
2994
 * @var array
2995
 */
2996
	public $hasAndBelongsToMany = array('Uuiditem');
2997
}
2998
 
2999
/**
3000
 * Uuiditem class
3001
 *
3002
 * @package       Cake.Test.Case.Model
3003
 */
3004
class Uuiditem extends CakeTestModel {
3005
 
3006
/**
3007
 * name property
3008
 *
3009
 * @var string
3010
 */
3011
	public $name = 'Uuiditem';
3012
 
3013
/**
3014
 * hasAndBelongsToMany property
3015
 *
3016
 * @var array
3017
 */
3018
	public $hasAndBelongsToMany = array('Uuidportfolio' => array('with' => 'UuiditemsUuidportfolioNumericid'));
3019
 
3020
}
3021
 
3022
/**
3023
 * UuiditemsPortfolio class
3024
 *
3025
 * @package       Cake.Test.Case.Model
3026
 */
3027
class UuiditemsUuidportfolio extends CakeTestModel {
3028
 
3029
/**
3030
 * name property
3031
 *
3032
 * @var string
3033
 */
3034
	public $name = 'UuiditemsUuidportfolio';
3035
}
3036
 
3037
/**
3038
 * UuiditemsPortfolioNumericid class
3039
 *
3040
 * @package       Cake.Test.Case.Model
3041
 */
3042
class UuiditemsUuidportfolioNumericid extends CakeTestModel {
3043
 
3044
/**
3045
 * name property
3046
 *
3047
 * @var string
3048
 */
3049
	public $name = 'UuiditemsUuidportfolioNumericid';
3050
}
3051
 
3052
/**
3053
 * TranslateTestModel class.
3054
 *
3055
 * @package       Cake.Test.Case.Model
3056
 */
3057
class TranslateTestModel extends CakeTestModel {
3058
 
3059
/**
3060
 * name property
3061
 *
3062
 * @var string
3063
 */
3064
	public $name = 'TranslateTestModel';
3065
 
3066
/**
3067
 * useTable property
3068
 *
3069
 * @var string
3070
 */
3071
	public $useTable = 'i18n';
3072
 
3073
/**
3074
 * displayField property
3075
 *
3076
 * @var string
3077
 */
3078
	public $displayField = 'field';
3079
}
3080
 
3081
/**
3082
 * TranslateTestModel class.
3083
 *
3084
 * @package       Cake.Test.Case.Model
3085
 */
3086
class TranslateWithPrefix extends CakeTestModel {
3087
 
3088
/**
3089
 * name property
3090
 *
3091
 * @var string
3092
 */
3093
	public $name = 'TranslateWithPrefix';
3094
 
3095
/**
3096
 * tablePrefix property
3097
 *
3098
 * @var string
3099
 */
3100
	public $tablePrefix = 'i18n_';
3101
 
3102
/**
3103
 * displayField property
3104
 *
3105
 * @var string
3106
 */
3107
	public $displayField = 'field';
3108
 
3109
}
3110
 
3111
/**
3112
 * TranslatedItem class.
3113
 *
3114
 * @package       Cake.Test.Case.Model
3115
 */
3116
class TranslatedItem extends CakeTestModel {
3117
 
3118
/**
3119
 * name property
3120
 *
3121
 * @var string
3122
 */
3123
	public $name = 'TranslatedItem';
3124
 
3125
/**
3126
 * cacheQueries property
3127
 *
3128
 * @var bool
3129
 */
3130
	public $cacheQueries = false;
3131
 
3132
/**
3133
 * actsAs property
3134
 *
3135
 * @var array
3136
 */
3137
	public $actsAs = array('Translate' => array('content', 'title'));
3138
 
3139
/**
3140
 * translateModel property
3141
 *
3142
 * @var string
3143
 */
3144
	public $translateModel = 'TranslateTestModel';
3145
 
3146
}
3147
 
3148
/**
3149
 * TranslatedItem class.
3150
 *
3151
 * @package       Cake.Test.Case.Model
3152
 */
3153
class TranslatedItem2 extends CakeTestModel {
3154
 
3155
/**
3156
 * name property
3157
 *
3158
 * @var string
3159
 */
3160
	public $name = 'TranslatedItem';
3161
 
3162
/**
3163
 * cacheQueries property
3164
 *
3165
 * @var bool
3166
 */
3167
	public $cacheQueries = false;
3168
 
3169
/**
3170
 * actsAs property
3171
 *
3172
 * @var array
3173
 */
3174
	public $actsAs = array('Translate' => array('content', 'title'));
3175
 
3176
/**
3177
 * translateModel property
3178
 *
3179
 * @var string
3180
 */
3181
	public $translateModel = 'TranslateWithPrefix';
3182
 
3183
}
3184
 
3185
/**
3186
 * TranslatedItemWithTable class.
3187
 *
3188
 * @package       Cake.Test.Case.Model
3189
 */
3190
class TranslatedItemWithTable extends CakeTestModel {
3191
 
3192
/**
3193
 * name property
3194
 *
3195
 * @var string
3196
 */
3197
	public $name = 'TranslatedItemWithTable';
3198
 
3199
/**
3200
 * useTable property
3201
 *
3202
 * @var string
3203
 */
3204
	public $useTable = 'translated_items';
3205
 
3206
/**
3207
 * cacheQueries property
3208
 *
3209
 * @var bool
3210
 */
3211
	public $cacheQueries = false;
3212
 
3213
/**
3214
 * actsAs property
3215
 *
3216
 * @var array
3217
 */
3218
	public $actsAs = array('Translate' => array('content', 'title'));
3219
 
3220
/**
3221
 * translateModel property
3222
 *
3223
 * @var string
3224
 */
3225
	public $translateModel = 'TranslateTestModel';
3226
 
3227
/**
3228
 * translateTable property
3229
 *
3230
 * @var string
3231
 */
3232
	public $translateTable = 'another_i18n';
3233
 
3234
}
3235
 
3236
/**
3237
 * TranslateArticleModel class.
3238
 *
3239
 * @package       Cake.Test.Case.Model
3240
 */
3241
class TranslateArticleModel extends CakeTestModel {
3242
 
3243
/**
3244
 * name property
3245
 *
3246
 * @var string
3247
 */
3248
	public $name = 'TranslateArticleModel';
3249
 
3250
/**
3251
 * useTable property
3252
 *
3253
 * @var string
3254
 */
3255
	public $useTable = 'article_i18n';
3256
 
3257
/**
3258
 * displayField property
3259
 *
3260
 * @var string
3261
 */
3262
	public $displayField = 'field';
3263
 
3264
}
3265
 
3266
/**
3267
 * TranslatedArticle class.
3268
 *
3269
 * @package       Cake.Test.Case.Model
3270
 */
3271
class TranslatedArticle extends CakeTestModel {
3272
 
3273
/**
3274
 * name property
3275
 *
3276
 * @var string
3277
 */
3278
	public $name = 'TranslatedArticle';
3279
 
3280
/**
3281
 * cacheQueries property
3282
 *
3283
 * @var bool
3284
 */
3285
	public $cacheQueries = false;
3286
 
3287
/**
3288
 * actsAs property
3289
 *
3290
 * @var array
3291
 */
3292
	public $actsAs = array('Translate' => array('title', 'body'));
3293
 
3294
/**
3295
 * translateModel property
3296
 *
3297
 * @var string
3298
 */
3299
	public $translateModel = 'TranslateArticleModel';
3300
 
3301
/**
3302
 * belongsTo property
3303
 *
3304
 * @var array
3305
 */
3306
	public $belongsTo = array('User');
3307
 
3308
/**
3309
 * hasMany property
3310
 *
3311
 * @var array
3312
 */
3313
	public $hasMany = array('TranslatedItem');
3314
 
3315
}
3316
 
3317
class CounterCacheUser extends CakeTestModel {
3318
 
3319
	public $name = 'CounterCacheUser';
3320
 
3321
	public $alias = 'User';
3322
 
3323
	public $hasMany = array(
3324
		'Post' => array(
3325
			'className' => 'CounterCachePost',
3326
			'foreignKey' => 'user_id'
3327
		)
3328
	);
3329
}
3330
 
3331
class CounterCachePost extends CakeTestModel {
3332
 
3333
	public $name = 'CounterCachePost';
3334
 
3335
	public $alias = 'Post';
3336
 
3337
	public $belongsTo = array(
3338
		'User' => array(
3339
			'className' => 'CounterCacheUser',
3340
			'foreignKey' => 'user_id',
3341
			'counterCache' => true
3342
		)
3343
	);
3344
}
3345
 
3346
class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
3347
 
3348
	public $name = 'CounterCacheUserNonstandardPrimaryKey';
3349
 
3350
	public $alias = 'User';
3351
 
3352
	public $primaryKey = 'uid';
3353
 
3354
	public $hasMany = array(
3355
		'Post' => array(
3356
			'className' => 'CounterCachePostNonstandardPrimaryKey',
3357
			'foreignKey' => 'uid'
3358
		)
3359
	);
3360
 
3361
}
3362
 
3363
class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
3364
 
3365
	public $name = 'CounterCachePostNonstandardPrimaryKey';
3366
 
3367
	public $alias = 'Post';
3368
 
3369
	public $primaryKey = 'pid';
3370
 
3371
	public $belongsTo = array(
3372
		'User' => array(
3373
			'className' => 'CounterCacheUserNonstandardPrimaryKey',
3374
			'foreignKey' => 'uid',
3375
			'counterCache' => true
3376
		)
3377
	);
3378
 
3379
}
3380
 
3381
class ArticleB extends CakeTestModel {
3382
 
3383
	public $name = 'ArticleB';
3384
 
3385
	public $useTable = 'articles';
3386
 
3387
	public $hasAndBelongsToMany = array(
3388
		'TagB' => array(
3389
			'className' => 'TagB',
3390
			'joinTable' => 'articles_tags',
3391
			'foreignKey' => 'article_id',
3392
			'associationForeignKey' => 'tag_id'
3393
		)
3394
	);
3395
 
3396
}
3397
 
3398
class TagB extends CakeTestModel {
3399
 
3400
	public $name = 'TagB';
3401
 
3402
	public $useTable = 'tags';
3403
 
3404
	public $hasAndBelongsToMany = array(
3405
		'ArticleB' => array(
3406
			'className' => 'ArticleB',
3407
			'joinTable' => 'articles_tags',
3408
			'foreignKey' => 'tag_id',
3409
			'associationForeignKey' => 'article_id'
3410
		)
3411
	);
3412
 
3413
}
3414
 
3415
class Fruit extends CakeTestModel {
3416
 
3417
	public $name = 'Fruit';
3418
 
3419
	public $hasAndBelongsToMany = array(
3420
		'UuidTag' => array(
3421
			'className' => 'UuidTag',
3422
			'joinTable' => 'fruits_uuid_tags',
3423
			'foreignKey' => 'fruit_id',
3424
			'associationForeignKey' => 'uuid_tag_id',
3425
			'with' => 'FruitsUuidTag'
3426
		)
3427
	);
3428
 
3429
}
3430
 
3431
class FruitsUuidTag extends CakeTestModel {
3432
 
3433
	public $name = 'FruitsUuidTag';
3434
 
3435
	public $primaryKey = false;
3436
 
3437
	public $belongsTo = array(
3438
		'UuidTag' => array(
3439
			'className' => 'UuidTag',
3440
			'foreignKey' => 'uuid_tag_id',
3441
		),
3442
		'Fruit' => array(
3443
			'className' => 'Fruit',
3444
			'foreignKey' => 'fruit_id',
3445
		)
3446
	);
3447
 
3448
}
3449
 
3450
class UuidTag extends CakeTestModel {
3451
 
3452
	public $name = 'UuidTag';
3453
 
3454
	public $hasAndBelongsToMany = array(
3455
		'Fruit' => array(
3456
			'className' => 'Fruit',
3457
			'joinTable' => 'fruits_uuid_tags',
3458
			'foreign_key' => 'uuid_tag_id',
3459
			'associationForeignKey' => 'fruit_id',
3460
			'with' => 'FruitsUuidTag'
3461
		)
3462
	);
3463
 
3464
}
3465
 
3466
class FruitNoWith extends CakeTestModel {
3467
 
3468
	public $name = 'Fruit';
3469
 
3470
	public $useTable = 'fruits';
3471
 
3472
	public $hasAndBelongsToMany = array(
3473
		'UuidTag' => array(
3474
			'className' => 'UuidTagNoWith',
3475
			'joinTable' => 'fruits_uuid_tags',
3476
			'foreignKey' => 'fruit_id',
3477
			'associationForeignKey' => 'uuid_tag_id',
3478
		)
3479
	);
3480
 
3481
}
3482
 
3483
class UuidTagNoWith extends CakeTestModel {
3484
 
3485
	public $name = 'UuidTag';
3486
 
3487
	public $useTable = 'uuid_tags';
3488
 
3489
	public $hasAndBelongsToMany = array(
3490
		'Fruit' => array(
3491
			'className' => 'FruitNoWith',
3492
			'joinTable' => 'fruits_uuid_tags',
3493
			'foreign_key' => 'uuid_tag_id',
3494
			'associationForeignKey' => 'fruit_id',
3495
		)
3496
	);
3497
 
3498
}
3499
 
3500
class ProductUpdateAll extends CakeTestModel {
3501
 
3502
	public $name = 'ProductUpdateAll';
3503
 
3504
	public $useTable = 'product_update_all';
3505
 
3506
}
3507
 
3508
class GroupUpdateAll extends CakeTestModel {
3509
 
3510
	public $name = 'GroupUpdateAll';
3511
 
3512
	public $useTable = 'group_update_all';
3513
 
3514
}
3515
 
3516
class TransactionTestModel extends CakeTestModel {
3517
 
3518
	public $name = 'TransactionTestModel';
3519
 
3520
	public $useTable = 'samples';
3521
 
3522
	public function afterSave($created, $options = array()) {
3523
		$data = array(
3524
			array('apple_id' => 1, 'name' => 'sample6'),
3525
		);
3526
		$this->saveAll($data, array('atomic' => true, 'callbacks' => false));
3527
	}
3528
 
3529
}
3530
 
3531
class TransactionManyTestModel extends CakeTestModel {
3532
 
3533
	public $name = 'TransactionManyTestModel';
3534
 
3535
	public $useTable = 'samples';
3536
 
3537
	public function afterSave($created, $options = array()) {
3538
		$data = array(
3539
			array('apple_id' => 1, 'name' => 'sample6'),
3540
		);
3541
		$this->saveMany($data, array('atomic' => true, 'callbacks' => false));
3542
	}
3543
 
3544
}
3545
 
3546
class Site extends CakeTestModel {
3547
 
3548
	public $name = 'Site';
3549
 
3550
	public $useTable = 'sites';
3551
 
3552
	public $hasAndBelongsToMany = array(
3553
		'Domain' => array('unique' => 'keepExisting'),
3554
	);
3555
}
3556
 
3557
class Domain extends CakeTestModel {
3558
 
3559
	public $name = 'Domain';
3560
 
3561
	public $useTable = 'domains';
3562
 
3563
	public $hasAndBelongsToMany = array(
3564
		'Site' => array('unique' => 'keepExisting'),
3565
	);
3566
}
3567
 
3568
/**
3569
 * TestModel class
3570
 *
3571
 * @package       Cake.Test.Case.Model
3572
 */
3573
class TestModel extends CakeTestModel {
3574
 
3575
/**
3576
 * name property
3577
 *
3578
 * @var string
3579
 */
3580
	public $name = 'TestModel';
3581
 
3582
/**
3583
 * useTable property
3584
 *
3585
 * @var bool
3586
 */
3587
	public $useTable = false;
3588
 
3589
/**
3590
 * schema property
3591
 *
3592
 * @var array
3593
 */
3594
	protected $_schema = array(
3595
		'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3596
		'client_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
3597
		'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
3598
		'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
3599
		'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
3600
		'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
3601
		'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
3602
		'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
3603
		'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
3604
		'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
3605
		'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
3606
		'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
3607
		'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
3608
		'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
3609
		'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => '155'),
3610
		'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
3611
		'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
3612
		'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
3613
	);
3614
 
3615
/**
3616
 * find method
3617
 *
3618
 * @param mixed $conditions
3619
 * @param mixed $fields
3620
 * @param mixed $order
3621
 * @param mixed $recursive
3622
 * @return void
3623
 */
3624
	public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
3625
		return array($conditions, $fields);
3626
	}
3627
 
3628
/**
3629
 * findAll method
3630
 *
3631
 * @param mixed $conditions
3632
 * @param mixed $fields
3633
 * @param mixed $order
3634
 * @param mixed $recursive
3635
 * @return void
3636
 */
3637
	public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
3638
		return $conditions;
3639
	}
3640
 
3641
}
3642
 
3643
/**
3644
 * TestModel2 class
3645
 *
3646
 * @package       Cake.Test.Case.Model
3647
 */
3648
class TestModel2 extends CakeTestModel {
3649
 
3650
/**
3651
 * name property
3652
 *
3653
 * @var string
3654
 */
3655
	public $name = 'TestModel2';
3656
 
3657
/**
3658
 * useTable property
3659
 *
3660
 * @var bool
3661
 */
3662
	public $useTable = false;
3663
}
3664
 
3665
/**
3666
 * TestModel4 class
3667
 *
3668
 * @package       Cake.Test.Case.Model
3669
 */
3670
class TestModel3 extends CakeTestModel {
3671
 
3672
/**
3673
 * name property
3674
 *
3675
 * @var string
3676
 */
3677
	public $name = 'TestModel3';
3678
 
3679
/**
3680
 * useTable property
3681
 *
3682
 * @var bool
3683
 */
3684
	public $useTable = false;
3685
}
3686
 
3687
/**
3688
 * TestModel4 class
3689
 *
3690
 * @package       Cake.Test.Case.Model
3691
 */
3692
class TestModel4 extends CakeTestModel {
3693
 
3694
/**
3695
 * name property
3696
 *
3697
 * @var string
3698
 */
3699
	public $name = 'TestModel4';
3700
 
3701
/**
3702
 * table property
3703
 *
3704
 * @var string
3705
 */
3706
	public $table = 'test_model4';
3707
 
3708
/**
3709
 * useTable property
3710
 *
3711
 * @var bool
3712
 */
3713
	public $useTable = false;
3714
 
3715
/**
3716
 * belongsTo property
3717
 *
3718
 * @var array
3719
 */
3720
	public $belongsTo = array(
3721
		'TestModel4Parent' => array(
3722
			'className' => 'TestModel4',
3723
			'foreignKey' => 'parent_id'
3724
		)
3725
	);
3726
 
3727
/**
3728
 * hasOne property
3729
 *
3730
 * @var array
3731
 */
3732
	public $hasOne = array(
3733
		'TestModel5' => array(
3734
			'className' => 'TestModel5',
3735
			'foreignKey' => 'test_model4_id'
3736
		)
3737
	);
3738
 
3739
/**
3740
 * hasAndBelongsToMany property
3741
 *
3742
 * @var array
3743
 */
3744
	public $hasAndBelongsToMany = array('TestModel7' => array(
3745
		'className' => 'TestModel7',
3746
		'joinTable' => 'test_model4_test_model7',
3747
		'foreignKey' => 'test_model4_id',
3748
		'associationForeignKey' => 'test_model7_id',
3749
		'with' => 'TestModel4TestModel7'
3750
	));
3751
 
3752
/**
3753
 * schema method
3754
 *
3755
 * @return void
3756
 */
3757
	public function schema($field = false) {
3758
		if (!isset($this->_schema)) {
3759
			$this->_schema = array(
3760
				'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3761
				'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
3762
				'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
3763
				'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
3764
			);
3765
		}
3766
		return $this->_schema;
3767
	}
3768
 
3769
}
3770
 
3771
/**
3772
 * TestModel4TestModel7 class
3773
 *
3774
 * @package       Cake.Test.Case.Model
3775
 */
3776
class TestModel4TestModel7 extends CakeTestModel {
3777
 
3778
/**
3779
 * name property
3780
 *
3781
 * @var string
3782
 */
3783
	public $name = 'TestModel4TestModel7';
3784
 
3785
/**
3786
 * table property
3787
 *
3788
 * @var string
3789
 */
3790
	public $table = 'test_model4_test_model7';
3791
 
3792
/**
3793
 * useTable property
3794
 *
3795
 * @var bool
3796
 */
3797
	public $useTable = false;
3798
 
3799
/**
3800
 * schema method
3801
 *
3802
 * @return void
3803
 */
3804
	public function schema($field = false) {
3805
		if (!isset($this->_schema)) {
3806
			$this->_schema = array(
3807
				'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3808
				'test_model7_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8')
3809
			);
3810
		}
3811
		return $this->_schema;
3812
	}
3813
 
3814
}
3815
 
3816
/**
3817
 * TestModel5 class
3818
 *
3819
 * @package       Cake.Test.Case.Model
3820
 */
3821
class TestModel5 extends CakeTestModel {
3822
 
3823
/**
3824
 * name property
3825
 *
3826
 * @var string
3827
 */
3828
	public $name = 'TestModel5';
3829
 
3830
/**
3831
 * table property
3832
 *
3833
 * @var string
3834
 */
3835
	public $table = 'test_model5';
3836
 
3837
/**
3838
 * useTable property
3839
 *
3840
 * @var bool
3841
 */
3842
	public $useTable = false;
3843
 
3844
/**
3845
 * belongsTo property
3846
 *
3847
 * @var array
3848
 */
3849
	public $belongsTo = array('TestModel4' => array(
3850
		'className' => 'TestModel4',
3851
		'foreignKey' => 'test_model4_id'
3852
	));
3853
 
3854
/**
3855
 * hasMany property
3856
 *
3857
 * @var array
3858
 */
3859
	public $hasMany = array('TestModel6' => array(
3860
		'className' => 'TestModel6',
3861
		'foreignKey' => 'test_model5_id'
3862
	));
3863
 
3864
/**
3865
 * schema method
3866
 *
3867
 * @return void
3868
 */
3869
	public function schema($field = false) {
3870
		if (!isset($this->_schema)) {
3871
			$this->_schema = array(
3872
				'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3873
				'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3874
				'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
3875
				'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
3876
				'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
3877
			);
3878
		}
3879
		return $this->_schema;
3880
	}
3881
 
3882
}
3883
 
3884
/**
3885
 * TestModel6 class
3886
 *
3887
 * @package       Cake.Test.Case.Model
3888
 */
3889
class TestModel6 extends CakeTestModel {
3890
 
3891
/**
3892
 * name property
3893
 *
3894
 * @var string
3895
 */
3896
	public $name = 'TestModel6';
3897
 
3898
/**
3899
 * table property
3900
 *
3901
 * @var string
3902
 */
3903
	public $table = 'test_model6';
3904
 
3905
/**
3906
 * useTable property
3907
 *
3908
 * @var bool
3909
 */
3910
	public $useTable = false;
3911
 
3912
/**
3913
 * belongsTo property
3914
 *
3915
 * @var array
3916
 */
3917
	public $belongsTo = array(
3918
		'TestModel5' => array(
3919
			'className' => 'TestModel5',
3920
			'foreignKey' => 'test_model5_id'
3921
		)
3922
	);
3923
 
3924
/**
3925
 * schema method
3926
 *
3927
 * @return void
3928
 */
3929
	public function schema($field = false) {
3930
		if (!isset($this->_schema)) {
3931
			$this->_schema = array(
3932
				'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3933
				'test_model5_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3934
				'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
3935
				'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
3936
				'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
3937
			);
3938
		}
3939
		return $this->_schema;
3940
	}
3941
 
3942
}
3943
 
3944
/**
3945
 * TestModel7 class
3946
 *
3947
 * @package       Cake.Test.Case.Model
3948
 */
3949
class TestModel7 extends CakeTestModel {
3950
 
3951
/**
3952
 * name property
3953
 *
3954
 * @var string
3955
 */
3956
	public $name = 'TestModel7';
3957
 
3958
/**
3959
 * table property
3960
 *
3961
 * @var string
3962
 */
3963
	public $table = 'test_model7';
3964
 
3965
/**
3966
 * useTable property
3967
 *
3968
 * @var bool
3969
 */
3970
	public $useTable = false;
3971
 
3972
/**
3973
 * schema method
3974
 *
3975
 * @return void
3976
 */
3977
	public function schema($field = false) {
3978
		if (!isset($this->_schema)) {
3979
			$this->_schema = array(
3980
				'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
3981
				'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
3982
				'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
3983
				'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
3984
			);
3985
		}
3986
		return $this->_schema;
3987
	}
3988
 
3989
}
3990
 
3991
/**
3992
 * TestModel8 class
3993
 *
3994
 * @package       Cake.Test.Case.Model
3995
 */
3996
class TestModel8 extends CakeTestModel {
3997
 
3998
/**
3999
 * name property
4000
 *
4001
 * @var string
4002
 */
4003
	public $name = 'TestModel8';
4004
 
4005
/**
4006
 * table property
4007
 *
4008
 * @var string
4009
 */
4010
	public $table = 'test_model8';
4011
 
4012
/**
4013
 * useTable property
4014
 *
4015
 * @var bool
4016
 */
4017
	public $useTable = false;
4018
 
4019
/**
4020
 * hasOne property
4021
 *
4022
 * @var array
4023
 */
4024
	public $hasOne = array(
4025
		'TestModel9' => array(
4026
			'className' => 'TestModel9',
4027
			'foreignKey' => 'test_model8_id',
4028
			'conditions' => 'TestModel9.name != \'mariano\''
4029
		)
4030
	);
4031
 
4032
/**
4033
 * schema method
4034
 *
4035
 * @return void
4036
 */
4037
	public function schema($field = false) {
4038
		if (!isset($this->_schema)) {
4039
			$this->_schema = array(
4040
				'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
4041
				'test_model9_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
4042
				'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
4043
				'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
4044
				'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
4045
			);
4046
		}
4047
		return $this->_schema;
4048
	}
4049
 
4050
}
4051
 
4052
/**
4053
 * TestModel9 class
4054
 *
4055
 * @package       Cake.Test.Case.Model
4056
 */
4057
class TestModel9 extends CakeTestModel {
4058
 
4059
/**
4060
 * name property
4061
 *
4062
 * @var string
4063
 */
4064
	public $name = 'TestModel9';
4065
 
4066
/**
4067
 * table property
4068
 *
4069
 * @var string
4070
 */
4071
	public $table = 'test_model9';
4072
 
4073
/**
4074
 * useTable property
4075
 *
4076
 * @var bool
4077
 */
4078
	public $useTable = false;
4079
 
4080
/**
4081
 * belongsTo property
4082
 *
4083
 * @var array
4084
 */
4085
	public $belongsTo = array(
4086
		'TestModel8' => array(
4087
			'className' => 'TestModel8',
4088
			'foreignKey' => 'test_model8_id',
4089
			'conditions' => 'TestModel8.name != \'larry\''
4090
		)
4091
	);
4092
 
4093
/**
4094
 * schema method
4095
 *
4096
 * @return void
4097
 */
4098
	public function schema($field = false) {
4099
		if (!isset($this->_schema)) {
4100
			$this->_schema = array(
4101
				'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
4102
				'test_model8_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
4103
				'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
4104
				'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
4105
				'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
4106
			);
4107
		}
4108
		return $this->_schema;
4109
	}
4110
 
4111
}
4112
 
4113
/**
4114
 * Level class
4115
 *
4116
 * @package       Cake.Test.Case.Model
4117
 */
4118
class Level extends CakeTestModel {
4119
 
4120
/**
4121
 * name property
4122
 *
4123
 * @var string
4124
 */
4125
	public $name = 'Level';
4126
 
4127
/**
4128
 * table property
4129
 *
4130
 * @var string
4131
 */
4132
	public $table = 'level';
4133
 
4134
/**
4135
 * useTable property
4136
 *
4137
 * @var bool
4138
 */
4139
	public $useTable = false;
4140
 
4141
/**
4142
 * hasMany property
4143
 *
4144
 * @var array
4145
 */
4146
	public $hasMany = array(
4147
		'Group' => array(
4148
			'className' => 'Group'
4149
		),
4150
		'User2' => array(
4151
			'className' => 'User2'
4152
		)
4153
	);
4154
 
4155
/**
4156
 * schema method
4157
 *
4158
 * @return void
4159
 */
4160
	public function schema($field = false) {
4161
		if (!isset($this->_schema)) {
4162
			$this->_schema = array(
4163
				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4164
				'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
4165
			);
4166
		}
4167
		return $this->_schema;
4168
	}
4169
 
4170
}
4171
 
4172
/**
4173
 * Group class
4174
 *
4175
 * @package       Cake.Test.Case.Model
4176
 */
4177
class Group extends CakeTestModel {
4178
 
4179
/**
4180
 * name property
4181
 *
4182
 * @var string
4183
 */
4184
	public $name = 'Group';
4185
 
4186
/**
4187
 * table property
4188
 *
4189
 * @var string
4190
 */
4191
	public $table = 'group';
4192
 
4193
/**
4194
 * useTable property
4195
 *
4196
 * @var bool
4197
 */
4198
	public $useTable = false;
4199
 
4200
/**
4201
 * belongsTo property
4202
 *
4203
 * @var array
4204
 */
4205
	public $belongsTo = array('Level');
4206
 
4207
/**
4208
 * hasMany property
4209
 *
4210
 * @var array
4211
 */
4212
	public $hasMany = array('Category2', 'User2');
4213
 
4214
/**
4215
 * schema method
4216
 *
4217
 * @return void
4218
 */
4219
	public function schema($field = false) {
4220
		if (!isset($this->_schema)) {
4221
			$this->_schema = array(
4222
				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4223
				'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4224
				'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
4225
			);
4226
		}
4227
		return $this->_schema;
4228
	}
4229
 
4230
}
4231
 
4232
/**
4233
 * User2 class
4234
 *
4235
 * @package       Cake.Test.Case.Model
4236
 */
4237
class User2 extends CakeTestModel {
4238
 
4239
/**
4240
 * name property
4241
 *
4242
 * @var string
4243
 */
4244
	public $name = 'User2';
4245
 
4246
/**
4247
 * table property
4248
 *
4249
 * @var string
4250
 */
4251
	public $table = 'user';
4252
 
4253
/**
4254
 * useTable property
4255
 *
4256
 * @var bool
4257
 */
4258
	public $useTable = false;
4259
 
4260
/**
4261
 * belongsTo property
4262
 *
4263
 * @var array
4264
 */
4265
	public $belongsTo = array(
4266
		'Group' => array(
4267
			'className' => 'Group'
4268
		),
4269
		'Level' => array(
4270
			'className' => 'Level'
4271
		)
4272
	);
4273
 
4274
/**
4275
 * hasMany property
4276
 *
4277
 * @var array
4278
 */
4279
	public $hasMany = array(
4280
		'Article2' => array(
4281
			'className' => 'Article2'
4282
		),
4283
	);
4284
 
4285
/**
4286
 * schema method
4287
 *
4288
 * @return void
4289
 */
4290
	public function schema($field = false) {
4291
		if (!isset($this->_schema)) {
4292
			$this->_schema = array(
4293
				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4294
				'group_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4295
				'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4296
				'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
4297
			);
4298
		}
4299
		return $this->_schema;
4300
	}
4301
 
4302
}
4303
 
4304
/**
4305
 * Category2 class
4306
 *
4307
 * @package       Cake.Test.Case.Model
4308
 */
4309
class Category2 extends CakeTestModel {
4310
 
4311
/**
4312
 * name property
4313
 *
4314
 * @var string
4315
 */
4316
	public $name = 'Category2';
4317
 
4318
/**
4319
 * table property
4320
 *
4321
 * @var string
4322
 */
4323
	public $table = 'category';
4324
 
4325
/**
4326
 * useTable property
4327
 *
4328
 * @var bool
4329
 */
4330
	public $useTable = false;
4331
 
4332
/**
4333
 * belongsTo property
4334
 *
4335
 * @var array
4336
 */
4337
	public $belongsTo = array(
4338
		'Group' => array(
4339
			'className' => 'Group',
4340
			'foreignKey' => 'group_id'
4341
		),
4342
		'ParentCat' => array(
4343
			'className' => 'Category2',
4344
			'foreignKey' => 'parent_id'
4345
		)
4346
	);
4347
 
4348
/**
4349
 * hasMany property
4350
 *
4351
 * @var array
4352
 */
4353
	public $hasMany = array(
4354
		'ChildCat' => array(
4355
			'className' => 'Category2',
4356
			'foreignKey' => 'parent_id'
4357
		),
4358
		'Article2' => array(
4359
			'className' => 'Article2',
4360
			'order' => 'Article2.published_date DESC',
4361
			'foreignKey' => 'category_id',
4362
			'limit' => '3')
4363
	);
4364
 
4365
/**
4366
 * schema method
4367
 *
4368
 * @return void
4369
 */
4370
	public function schema($field = false) {
4371
		if (!isset($this->_schema)) {
4372
			$this->_schema = array(
4373
				'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
4374
				'group_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
4375
				'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
4376
				'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
4377
				'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
4378
				'description' => array('type' => 'text', 'null' => false, 'default' => '', 'length' => null),
4379
 
4380
			);
4381
		}
4382
		return $this->_schema;
4383
	}
4384
 
4385
}
4386
 
4387
/**
4388
 * Article2 class
4389
 *
4390
 * @package       Cake.Test.Case.Model
4391
 */
4392
class Article2 extends CakeTestModel {
4393
 
4394
/**
4395
 * name property
4396
 *
4397
 * @var string
4398
 */
4399
	public $name = 'Article2';
4400
 
4401
/**
4402
 * table property
4403
 *
4404
 * @var string
4405
 */
4406
	public $table = 'articles';
4407
 
4408
/**
4409
 * useTable property
4410
 *
4411
 * @var bool
4412
 */
4413
	public $useTable = false;
4414
 
4415
/**
4416
 * belongsTo property
4417
 *
4418
 * @var array
4419
 */
4420
	public $belongsTo = array(
4421
		'Category2' => array('className' => 'Category2'),
4422
		'User2' => array('className' => 'User2')
4423
	);
4424
 
4425
/**
4426
 * schema method
4427
 *
4428
 * @return void
4429
 */
4430
	public function schema($field = false) {
4431
		if (!isset($this->_schema)) {
4432
			$this->_schema = array(
4433
				'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
4434
				'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4435
				'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4436
				'rate_count' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4437
				'rate_sum' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4438
				'viewed' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4439
				'version' => array('type' => 'string', 'null' => true, 'default' => '', 'length' => '45'),
4440
				'title' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '200'),
4441
				'intro' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
4442
				'comments' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '4'),
4443
				'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
4444
				'isdraft' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
4445
				'allow_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
4446
				'moderate_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
4447
				'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
4448
				'multipage' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
4449
				'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
4450
				'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
4451
				'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
4452
			);
4453
		}
4454
		return $this->_schema;
4455
	}
4456
 
4457
}
4458
 
4459
/**
4460
 * CategoryFeatured2 class
4461
 *
4462
 * @package       Cake.Test.Case.Model
4463
 */
4464
class CategoryFeatured2 extends CakeTestModel {
4465
 
4466
/**
4467
 * name property
4468
 *
4469
 * @var string
4470
 */
4471
	public $name = 'CategoryFeatured2';
4472
 
4473
/**
4474
 * table property
4475
 *
4476
 * @var string
4477
 */
4478
	public $table = 'category_featured';
4479
 
4480
/**
4481
 * useTable property
4482
 *
4483
 * @var bool
4484
 */
4485
	public $useTable = false;
4486
 
4487
/**
4488
 * schema method
4489
 *
4490
 * @return void
4491
 */
4492
	public function schema($field = false) {
4493
		if (!isset($this->_schema)) {
4494
			$this->_schema = array(
4495
				'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
4496
				'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
4497
				'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
4498
				'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
4499
				'description' => array('text' => 'string', 'null' => false, 'default' => '', 'length' => null)
4500
			);
4501
		}
4502
		return $this->_schema;
4503
	}
4504
 
4505
}
4506
 
4507
/**
4508
 * Featured2 class
4509
 *
4510
 * @package       Cake.Test.Case.Model
4511
 */
4512
class Featured2 extends CakeTestModel {
4513
 
4514
/**
4515
 * name property
4516
 *
4517
 * @var string
4518
 */
4519
	public $name = 'Featured2';
4520
 
4521
/**
4522
 * table property
4523
 *
4524
 * @var string
4525
 */
4526
	public $table = 'featured2';
4527
 
4528
/**
4529
 * useTable property
4530
 *
4531
 * @var bool
4532
 */
4533
	public $useTable = false;
4534
 
4535
/**
4536
 * belongsTo property
4537
 *
4538
 * @var array
4539
 */
4540
	public $belongsTo = array(
4541
		'CategoryFeatured2' => array(
4542
			'className' => 'CategoryFeatured2'
4543
		)
4544
	);
4545
 
4546
/**
4547
 * schema method
4548
 *
4549
 * @return void
4550
 */
4551
	public function schema($field = false) {
4552
		if (!isset($this->_schema)) {
4553
			$this->_schema = array(
4554
				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4555
				'article_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4556
				'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4557
				'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
4558
			);
4559
		}
4560
		return $this->_schema;
4561
	}
4562
 
4563
}
4564
 
4565
/**
4566
 * Comment2 class
4567
 *
4568
 * @package       Cake.Test.Case.Model
4569
 */
4570
class Comment2 extends CakeTestModel {
4571
 
4572
/**
4573
 * name property
4574
 *
4575
 * @var string
4576
 */
4577
	public $name = 'Comment2';
4578
 
4579
/**
4580
 * table property
4581
 *
4582
 * @var string
4583
 */
4584
	public $table = 'comment';
4585
 
4586
/**
4587
 * belongsTo property
4588
 *
4589
 * @var array
4590
 */
4591
	public $belongsTo = array('ArticleFeatured2', 'User2');
4592
 
4593
/**
4594
 * useTable property
4595
 *
4596
 * @var bool
4597
 */
4598
	public $useTable = false;
4599
 
4600
/**
4601
 * schema method
4602
 *
4603
 * @return void
4604
 */
4605
	public function schema($field = false) {
4606
		if (!isset($this->_schema)) {
4607
			$this->_schema = array(
4608
				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4609
				'article_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4610
				'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4611
				'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
4612
			);
4613
		}
4614
		return $this->_schema;
4615
	}
4616
 
4617
}
4618
 
4619
/**
4620
 * ArticleFeatured2 class
4621
 *
4622
 * @package       Cake.Test.Case.Model
4623
 */
4624
class ArticleFeatured2 extends CakeTestModel {
4625
 
4626
/**
4627
 * name property
4628
 *
4629
 * @var string
4630
 */
4631
	public $name = 'ArticleFeatured2';
4632
 
4633
/**
4634
 * table property
4635
 *
4636
 * @var string
4637
 */
4638
	public $table = 'article_featured';
4639
 
4640
/**
4641
 * useTable property
4642
 *
4643
 * @var bool
4644
 */
4645
	public $useTable = false;
4646
 
4647
/**
4648
 * belongsTo property
4649
 *
4650
 * @var array
4651
 */
4652
	public $belongsTo = array(
4653
		'CategoryFeatured2' => array('className' => 'CategoryFeatured2'),
4654
		'User2' => array('className' => 'User2')
4655
	);
4656
 
4657
/**
4658
 * hasOne property
4659
 *
4660
 * @var array
4661
 */
4662
	public $hasOne = array(
4663
		'Featured2' => array('className' => 'Featured2')
4664
	);
4665
 
4666
/**
4667
 * hasMany property
4668
 *
4669
 * @var array
4670
 */
4671
	public $hasMany = array(
4672
		'Comment2' => array('className' => 'Comment2', 'dependent' => true)
4673
	);
4674
 
4675
/**
4676
 * schema method
4677
 *
4678
 * @return void
4679
 */
4680
	public function schema($field = false) {
4681
		if (!isset($this->_schema)) {
4682
			$this->_schema = array(
4683
				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
4684
				'category_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4685
				'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
4686
				'title' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
4687
				'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
4688
				'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
4689
				'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
4690
				'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
4691
				'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
4692
			);
4693
		}
4694
		return $this->_schema;
4695
	}
4696
 
4697
}
4698
 
4699
/**
4700
 * MysqlTestModel class
4701
 *
4702
 * @package       Cake.Test.Case.Model
4703
 */
4704
class MysqlTestModel extends Model {
4705
 
4706
/**
4707
 * name property
4708
 *
4709
 * @var string
4710
 */
4711
	public $name = 'MysqlTestModel';
4712
 
4713
/**
4714
 * useTable property
4715
 *
4716
 * @var bool
4717
 */
4718
	public $useTable = false;
4719
 
4720
/**
4721
 * find method
4722
 *
4723
 * @param mixed $conditions
4724
 * @param mixed $fields
4725
 * @param mixed $order
4726
 * @param mixed $recursive
4727
 * @return void
4728
 */
4729
	public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
4730
		return $conditions;
4731
	}
4732
 
4733
/**
4734
 * findAll method
4735
 *
4736
 * @param mixed $conditions
4737
 * @param mixed $fields
4738
 * @param mixed $order
4739
 * @param mixed $recursive
4740
 * @return void
4741
 */
4742
	public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
4743
		return $conditions;
4744
	}
4745
 
4746
/**
4747
 * schema method
4748
 *
4749
 * @return void
4750
 */
4751
	public function schema($field = false) {
4752
		return array(
4753
			'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
4754
			'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
4755
			'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
4756
			'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
4757
			'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
4758
			'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
4759
			'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
4760
			'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
4761
			'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
4762
			'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
4763
			'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
4764
			'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
4765
			'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
4766
			'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
4767
			'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
4768
			'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
4769
			'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
4770
			'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
4771
		);
4772
	}
4773
 
4774
}
4775
 
4776
/**
4777
 * Test model for datasource prefixes
4778
 *
4779
 */
4780
class PrefixTestModel extends CakeTestModel {
4781
}
4782
 
4783
class PrefixTestUseTableModel extends CakeTestModel {
4784
 
4785
	public $name = 'PrefixTest';
4786
 
4787
	public $useTable = 'prefix_tests';
4788
 
4789
}
4790
 
4791
/**
4792
 * ScaffoldMock class
4793
 *
4794
 * @package       Cake.Test.Case.Controller
4795
 */
4796
class ScaffoldMock extends CakeTestModel {
4797
 
4798
/**
4799
 * useTable property
4800
 *
4801
 * @var string
4802
 */
4803
	public $useTable = 'articles';
4804
 
4805
/**
4806
 * belongsTo property
4807
 *
4808
 * @var array
4809
 */
4810
	public $belongsTo = array(
4811
		'User' => array(
4812
			'className' => 'ScaffoldUser',
4813
			'foreignKey' => 'user_id',
4814
		)
4815
	);
4816
 
4817
/**
4818
 * hasMany property
4819
 *
4820
 * @var array
4821
 */
4822
	public $hasMany = array(
4823
		'Comment' => array(
4824
			'className' => 'ScaffoldComment',
4825
			'foreignKey' => 'article_id',
4826
		)
4827
	);
4828
 
4829
/**
4830
 * hasAndBelongsToMany property
4831
 *
4832
 * @var string
4833
 */
4834
	public $hasAndBelongsToMany = array(
4835
		'ScaffoldTag' => array(
4836
			'className' => 'ScaffoldTag',
4837
			'foreignKey' => 'something_id',
4838
			'associationForeignKey' => 'something_else_id',
4839
			'joinTable' => 'join_things'
4840
		)
4841
	);
4842
 
4843
}
4844
 
4845
/**
4846
 * ScaffoldUser class
4847
 *
4848
 * @package       Cake.Test.Case.Controller
4849
 */
4850
class ScaffoldUser extends CakeTestModel {
4851
 
4852
/**
4853
 * useTable property
4854
 *
4855
 * @var string
4856
 */
4857
	public $useTable = 'users';
4858
 
4859
/**
4860
 * hasMany property
4861
 *
4862
 * @var array
4863
 */
4864
	public $hasMany = array(
4865
		'Article' => array(
4866
			'className' => 'ScaffoldMock',
4867
			'foreignKey' => 'article_id',
4868
		)
4869
	);
4870
}
4871
 
4872
/**
4873
 * ScaffoldComment class
4874
 *
4875
 * @package       Cake.Test.Case.Controller
4876
 */
4877
class ScaffoldComment extends CakeTestModel {
4878
 
4879
/**
4880
 * useTable property
4881
 *
4882
 * @var string
4883
 */
4884
	public $useTable = 'comments';
4885
 
4886
/**
4887
 * belongsTo property
4888
 *
4889
 * @var array
4890
 */
4891
	public $belongsTo = array(
4892
		'Article' => array(
4893
			'className' => 'ScaffoldMock',
4894
			'foreignKey' => 'article_id',
4895
		)
4896
	);
4897
}
4898
 
4899
/**
4900
 * ScaffoldTag class
4901
 *
4902
 * @package       Cake.Test.Case.Controller
4903
 */
4904
class ScaffoldTag extends CakeTestModel {
4905
 
4906
/**
4907
 * useTable property
4908
 *
4909
 * @var string
4910
 */
4911
	public $useTable = 'tags';
4912
 
4913
}
4914
 
4915
/**
4916
 * Player class
4917
 *
4918
 * @package       Cake.Test.Case.Model
4919
 */
4920
class Player extends CakeTestModel {
4921
 
4922
	public $hasAndBelongsToMany = array(
4923
		'Guild' => array(
4924
			'with' => 'GuildsPlayer',
4925
			'unique' => true,
4926
		),
4927
	);
4928
 
4929
}
4930
 
4931
/**
4932
 * Guild class
4933
 *
4934
 * @package       Cake.Test.Case.Model
4935
 */
4936
class Guild extends CakeTestModel {
4937
 
4938
	public $hasAndBelongsToMany = array(
4939
		'Player' => array(
4940
			'with' => 'GuildsPlayer',
4941
			'unique' => true,
4942
		),
4943
	);
4944
 
4945
}
4946
 
4947
/**
4948
 * GuildsPlayer class
4949
 *
4950
 * @package       Cake.Test.Case.Model
4951
 */
4952
class GuildsPlayer extends CakeTestModel {
4953
 
4954
	public $useDbConfig = 'test2';
4955
 
4956
	public $belongsTo = array(
4957
		'Player',
4958
		'Guild',
4959
		);
4960
}
4961
 
4962
/**
4963
 * Armor class
4964
 *
4965
 * @package       Cake.Test.Case.Model
4966
 */
4967
class Armor extends CakeTestModel {
4968
 
4969
	public $useDbConfig = 'test2';
4970
 
4971
	public $hasAndBelongsToMany = array(
4972
		'Player' => array('with' => 'ArmorsPlayer'),
4973
		);
4974
}
4975
 
4976
/**
4977
 * ArmorsPlayer class
4978
 *
4979
 * @package       Cake.Test.Case.Model
4980
 */
4981
class ArmorsPlayer extends CakeTestModel {
4982
 
4983
	public $useDbConfig = 'test_database_three';
4984
 
4985
}
4986
 
4987
/**
4988
 * CustomArticle class
4989
 *
4990
 * @package       Cake.Test.Case.Model
4991
 */
4992
class CustomArticle extends AppModel {
4993
 
4994
/**
4995
 * useTable property
4996
 *
4997
 * @var string
4998
 */
4999
	public $useTable = 'articles';
5000
 
5001
/**
5002
 * findMethods property
5003
 *
5004
 * @var array
5005
 */
5006
	public $findMethods = array('unPublished' => true);
5007
 
5008
/**
5009
 * belongsTo property
5010
 *
5011
 * @var array
5012
 */
5013
	public $belongsTo = array('User');
5014
 
5015
/**
5016
 * _findUnPublished custom find
5017
 *
5018
 * @return array
5019
 */
5020
	protected function _findUnPublished($state, $query, $results = array()) {
5021
		if ($state === 'before') {
5022
			$query['conditions']['published'] = 'N';
5023
			return $query;
5024
		}
5025
		return $results;
5026
	}
5027
 
5028
/**
5029
 * Alters title data
5030
 *
5031
 * @param array $options Options passed from Model::save().
5032
 * @return bool True if validate operation should continue, false to abort
5033
 * @see Model::save()
5034
 */
5035
	public function beforeValidate($options = array()) {
5036
		$this->data[$this->alias]['title'] = 'foo';
5037
		if ($this->findMethods['unPublished'] === true) {
5038
			$this->findMethods['unPublished'] = false;
5039
		} else {
5040
			$this->findMethods['unPublished'] = 'true again';
5041
		}
5042
	}
5043
 
5044
}