models.php 83 KB

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