models.php 81 KB

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