models.php 79 KB

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