models.php 83 KB

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