Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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