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