models.php 83 KB

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