models.php 81 KB

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