models.php 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027
  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. * afterFind callBack
  1301. *
  1302. * @param array $results
  1303. * @param bool $primary
  1304. * @return array
  1305. */
  1306. public function afterFind($results, $primary = false) {
  1307. foreach ($results as $key => $result) {
  1308. if(!empty($result[$this->alias]) && is_array($result[$this->alias])){
  1309. $results[$key][$this->alias]['afterFind'] = 'Successfuly added by AfterFind';
  1310. }
  1311. }
  1312. return $results;
  1313. }
  1314. }
  1315. /**
  1316. * JoinThing class
  1317. *
  1318. * @package Cake.Test.Case.Model
  1319. */
  1320. class JoinThing extends CakeTestModel {
  1321. /**
  1322. * name property
  1323. *
  1324. * @var string
  1325. */
  1326. public $name = 'JoinThing';
  1327. /**
  1328. * belongsTo property
  1329. *
  1330. * @var array
  1331. */
  1332. public $belongsTo = array('Something', 'SomethingElse');
  1333. /**
  1334. * afterFind callBack
  1335. *
  1336. * @param array $results
  1337. * @param bool $primary
  1338. * @return array
  1339. */
  1340. public function afterFind($results, $primary = false) {
  1341. foreach ($results as $key => $result) {
  1342. if(!empty($result[$this->alias]) && is_array($result[$this->alias])){
  1343. $results[$key][$this->alias]['afterFind'] = 'Successfuly added by AfterFind';
  1344. }
  1345. }
  1346. return $results;
  1347. }
  1348. }
  1349. /**
  1350. * Portfolio class
  1351. *
  1352. * @package Cake.Test.Case.Model
  1353. */
  1354. class Portfolio extends CakeTestModel {
  1355. /**
  1356. * name property
  1357. *
  1358. * @var string
  1359. */
  1360. public $name = 'Portfolio';
  1361. /**
  1362. * hasAndBelongsToMany property
  1363. *
  1364. * @var array
  1365. */
  1366. public $hasAndBelongsToMany = array('Item');
  1367. }
  1368. /**
  1369. * Item class
  1370. *
  1371. * @package Cake.Test.Case.Model
  1372. */
  1373. class Item extends CakeTestModel {
  1374. /**
  1375. * name property
  1376. *
  1377. * @var string
  1378. */
  1379. public $name = 'Item';
  1380. /**
  1381. * belongsTo property
  1382. *
  1383. * @var array
  1384. */
  1385. public $belongsTo = array('Syfile' => array('counterCache' => true));
  1386. /**
  1387. * hasAndBelongsToMany property
  1388. *
  1389. * @var array
  1390. */
  1391. public $hasAndBelongsToMany = array('Portfolio' => array('unique' => false));
  1392. }
  1393. /**
  1394. * ItemsPortfolio class
  1395. *
  1396. * @package Cake.Test.Case.Model
  1397. */
  1398. class ItemsPortfolio extends CakeTestModel {
  1399. /**
  1400. * name property
  1401. *
  1402. * @var string
  1403. */
  1404. public $name = 'ItemsPortfolio';
  1405. }
  1406. /**
  1407. * Syfile class
  1408. *
  1409. * @package Cake.Test.Case.Model
  1410. */
  1411. class Syfile extends CakeTestModel {
  1412. /**
  1413. * name property
  1414. *
  1415. * @var string
  1416. */
  1417. public $name = 'Syfile';
  1418. /**
  1419. * belongsTo property
  1420. *
  1421. * @var array
  1422. */
  1423. public $belongsTo = array('Image');
  1424. }
  1425. /**
  1426. * Image class
  1427. *
  1428. * @package Cake.Test.Case.Model
  1429. */
  1430. class Image extends CakeTestModel {
  1431. /**
  1432. * name property
  1433. *
  1434. * @var string
  1435. */
  1436. public $name = 'Image';
  1437. }
  1438. /**
  1439. * DeviceType class
  1440. *
  1441. * @package Cake.Test.Case.Model
  1442. */
  1443. class DeviceType extends CakeTestModel {
  1444. /**
  1445. * name property
  1446. *
  1447. * @var string
  1448. */
  1449. public $name = 'DeviceType';
  1450. /**
  1451. * order property
  1452. *
  1453. * @var array
  1454. */
  1455. public $order = array('DeviceType.order' => 'ASC');
  1456. /**
  1457. * belongsTo property
  1458. *
  1459. * @var array
  1460. */
  1461. public $belongsTo = array(
  1462. 'DeviceTypeCategory', 'FeatureSet', 'ExteriorTypeCategory',
  1463. 'Image' => array('className' => 'Document'),
  1464. 'Extra1' => array('className' => 'Document'),
  1465. 'Extra2' => array('className' => 'Document'));
  1466. /**
  1467. * hasMany property
  1468. *
  1469. * @var array
  1470. */
  1471. public $hasMany = array('Device' => array('order' => array('Device.id' => 'ASC')));
  1472. }
  1473. /**
  1474. * DeviceTypeCategory class
  1475. *
  1476. * @package Cake.Test.Case.Model
  1477. */
  1478. class DeviceTypeCategory extends CakeTestModel {
  1479. /**
  1480. * name property
  1481. *
  1482. * @var string
  1483. */
  1484. public $name = 'DeviceTypeCategory';
  1485. }
  1486. /**
  1487. * FeatureSet class
  1488. *
  1489. * @package Cake.Test.Case.Model
  1490. */
  1491. class FeatureSet extends CakeTestModel {
  1492. /**
  1493. * name property
  1494. *
  1495. * @var string
  1496. */
  1497. public $name = 'FeatureSet';
  1498. }
  1499. /**
  1500. * ExteriorTypeCategory class
  1501. *
  1502. * @package Cake.Test.Case.Model
  1503. */
  1504. class ExteriorTypeCategory extends CakeTestModel {
  1505. /**
  1506. * name property
  1507. *
  1508. * @var string
  1509. */
  1510. public $name = 'ExteriorTypeCategory';
  1511. /**
  1512. * belongsTo property
  1513. *
  1514. * @var array
  1515. */
  1516. public $belongsTo = array('Image' => array('className' => 'Device'));
  1517. }
  1518. /**
  1519. * Document class
  1520. *
  1521. * @package Cake.Test.Case.Model
  1522. */
  1523. class Document extends CakeTestModel {
  1524. /**
  1525. * name property
  1526. *
  1527. * @var string
  1528. */
  1529. public $name = 'Document';
  1530. /**
  1531. * belongsTo property
  1532. *
  1533. * @var array
  1534. */
  1535. public $belongsTo = array('DocumentDirectory');
  1536. }
  1537. /**
  1538. * Device class
  1539. *
  1540. * @package Cake.Test.Case.Model
  1541. */
  1542. class Device extends CakeTestModel {
  1543. /**
  1544. * name property
  1545. *
  1546. * @var string
  1547. */
  1548. public $name = 'Device';
  1549. }
  1550. /**
  1551. * DocumentDirectory class
  1552. *
  1553. * @package Cake.Test.Case.Model
  1554. */
  1555. class DocumentDirectory extends CakeTestModel {
  1556. /**
  1557. * name property
  1558. *
  1559. * @var string
  1560. */
  1561. public $name = 'DocumentDirectory';
  1562. }
  1563. /**
  1564. * PrimaryModel class
  1565. *
  1566. * @package Cake.Test.Case.Model
  1567. */
  1568. class PrimaryModel extends CakeTestModel {
  1569. /**
  1570. * name property
  1571. *
  1572. * @var string
  1573. */
  1574. public $name = 'PrimaryModel';
  1575. }
  1576. /**
  1577. * SecondaryModel class
  1578. *
  1579. * @package Cake.Test.Case.Model
  1580. */
  1581. class SecondaryModel extends CakeTestModel {
  1582. /**
  1583. * name property
  1584. *
  1585. * @var string
  1586. */
  1587. public $name = 'SecondaryModel';
  1588. }
  1589. /**
  1590. * JoinA class
  1591. *
  1592. * @package Cake.Test.Case.Model
  1593. */
  1594. class JoinA extends CakeTestModel {
  1595. /**
  1596. * name property
  1597. *
  1598. * @var string
  1599. */
  1600. public $name = 'JoinA';
  1601. /**
  1602. * hasAndBelongsToMany property
  1603. *
  1604. * @var array
  1605. */
  1606. public $hasAndBelongsToMany = array('JoinB', 'JoinC');
  1607. }
  1608. /**
  1609. * JoinB class
  1610. *
  1611. * @package Cake.Test.Case.Model
  1612. */
  1613. class JoinB extends CakeTestModel {
  1614. /**
  1615. * name property
  1616. *
  1617. * @var string
  1618. */
  1619. public $name = 'JoinB';
  1620. /**
  1621. * hasAndBelongsToMany property
  1622. *
  1623. * @var array
  1624. */
  1625. public $hasAndBelongsToMany = array('JoinA');
  1626. }
  1627. /**
  1628. * JoinC class
  1629. *
  1630. * @package Cake.Test.Case.Model
  1631. */
  1632. class JoinC extends CakeTestModel {
  1633. /**
  1634. * name property
  1635. *
  1636. * @var string
  1637. */
  1638. public $name = 'JoinC';
  1639. /**
  1640. * hasAndBelongsToMany property
  1641. *
  1642. * @var array
  1643. */
  1644. public $hasAndBelongsToMany = array('JoinA');
  1645. }
  1646. /**
  1647. * ThePaper class
  1648. *
  1649. * @package Cake.Test.Case.Model
  1650. */
  1651. class ThePaper extends CakeTestModel {
  1652. /**
  1653. * name property
  1654. *
  1655. * @var string
  1656. */
  1657. public $name = 'ThePaper';
  1658. /**
  1659. * useTable property
  1660. *
  1661. * @var string
  1662. */
  1663. public $useTable = 'apples';
  1664. /**
  1665. * hasOne property
  1666. *
  1667. * @var array
  1668. */
  1669. public $hasOne = array('Itself' => array('className' => 'ThePaper', 'foreignKey' => 'apple_id'));
  1670. /**
  1671. * hasAndBelongsToMany property
  1672. *
  1673. * @var array
  1674. */
  1675. public $hasAndBelongsToMany = array('Monkey' => array('joinTable' => 'the_paper_monkies', 'order' => 'id'));
  1676. }
  1677. /**
  1678. * Monkey class
  1679. *
  1680. * @package Cake.Test.Case.Model
  1681. */
  1682. class Monkey extends CakeTestModel {
  1683. /**
  1684. * name property
  1685. *
  1686. * @var string
  1687. */
  1688. public $name = 'Monkey';
  1689. /**
  1690. * useTable property
  1691. *
  1692. * @var string
  1693. */
  1694. public $useTable = 'devices';
  1695. }
  1696. /**
  1697. * AssociationTest1 class
  1698. *
  1699. * @package Cake.Test.Case.Model
  1700. */
  1701. class AssociationTest1 extends CakeTestModel {
  1702. /**
  1703. * useTable property
  1704. *
  1705. * @var string
  1706. */
  1707. public $useTable = 'join_as';
  1708. /**
  1709. * name property
  1710. *
  1711. * @var string
  1712. */
  1713. public $name = 'AssociationTest1';
  1714. /**
  1715. * hasAndBelongsToMany property
  1716. *
  1717. * @var array
  1718. */
  1719. public $hasAndBelongsToMany = array('AssociationTest2' => array(
  1720. 'unique' => false, 'joinTable' => 'join_as_join_bs', 'foreignKey' => false
  1721. ));
  1722. }
  1723. /**
  1724. * AssociationTest2 class
  1725. *
  1726. * @package Cake.Test.Case.Model
  1727. */
  1728. class AssociationTest2 extends CakeTestModel {
  1729. /**
  1730. * useTable property
  1731. *
  1732. * @var string
  1733. */
  1734. public $useTable = 'join_bs';
  1735. /**
  1736. * name property
  1737. *
  1738. * @var string
  1739. */
  1740. public $name = 'AssociationTest2';
  1741. /**
  1742. * hasAndBelongsToMany property
  1743. *
  1744. * @var array
  1745. */
  1746. public $hasAndBelongsToMany = array('AssociationTest1' => array(
  1747. 'unique' => false, 'joinTable' => 'join_as_join_bs'
  1748. ));
  1749. }
  1750. /**
  1751. * Callback class
  1752. *
  1753. * @package Cake.Test.Case.Model
  1754. */
  1755. class Callback extends CakeTestModel {
  1756. }
  1757. /**
  1758. * CallbackPostTestModel class
  1759. *
  1760. * @package Cake.Test.Case.Model
  1761. */
  1762. class CallbackPostTestModel extends CakeTestModel {
  1763. public $useTable = 'posts';
  1764. /**
  1765. * variable to control return of beforeValidate
  1766. *
  1767. * @var boolean
  1768. */
  1769. public $beforeValidateReturn = true;
  1770. /**
  1771. * variable to control return of beforeSave
  1772. *
  1773. * @var boolean
  1774. */
  1775. public $beforeSaveReturn = true;
  1776. /**
  1777. * variable to control return of beforeDelete
  1778. *
  1779. * @var boolean
  1780. */
  1781. public $beforeDeleteReturn = true;
  1782. /**
  1783. * beforeSave callback
  1784. *
  1785. * @return boolean
  1786. */
  1787. public function beforeSave($options = array()) {
  1788. return $this->beforeSaveReturn;
  1789. }
  1790. /**
  1791. * beforeValidate callback
  1792. *
  1793. * @return boolean
  1794. */
  1795. public function beforeValidate($options = array()) {
  1796. return $this->beforeValidateReturn;
  1797. }
  1798. /**
  1799. * beforeDelete callback
  1800. *
  1801. * @return boolean
  1802. */
  1803. public function beforeDelete($cascade = true) {
  1804. return $this->beforeDeleteReturn;
  1805. }
  1806. }
  1807. /**
  1808. * Uuid class
  1809. *
  1810. * @package Cake.Test.Case.Model
  1811. */
  1812. class Uuid extends CakeTestModel {
  1813. /**
  1814. * name property
  1815. *
  1816. * @var string
  1817. */
  1818. public $name = 'Uuid';
  1819. }
  1820. /**
  1821. * DataTest class
  1822. *
  1823. * @package Cake.Test.Case.Model
  1824. */
  1825. class DataTest extends CakeTestModel {
  1826. /**
  1827. * name property
  1828. *
  1829. * @var string
  1830. */
  1831. public $name = 'DataTest';
  1832. }
  1833. /**
  1834. * TheVoid class
  1835. *
  1836. * @package Cake.Test.Case.Model
  1837. */
  1838. class TheVoid extends CakeTestModel {
  1839. /**
  1840. * name property
  1841. *
  1842. * @var string
  1843. */
  1844. public $name = 'TheVoid';
  1845. /**
  1846. * useTable property
  1847. *
  1848. * @var bool false
  1849. */
  1850. public $useTable = false;
  1851. }
  1852. /**
  1853. * ValidationTest1 class
  1854. *
  1855. * @package Cake.Test.Case.Model
  1856. */
  1857. class ValidationTest1 extends CakeTestModel {
  1858. /**
  1859. * name property
  1860. *
  1861. * @var string
  1862. */
  1863. public $name = 'ValidationTest1';
  1864. /**
  1865. * useTable property
  1866. *
  1867. * @var bool false
  1868. */
  1869. public $useTable = false;
  1870. /**
  1871. * schema property
  1872. *
  1873. * @var array
  1874. */
  1875. protected $_schema = array();
  1876. /**
  1877. * validate property
  1878. *
  1879. * @var array
  1880. */
  1881. public $validate = array(
  1882. 'title' => 'notEmpty',
  1883. 'published' => 'customValidationMethod',
  1884. 'body' => array(
  1885. 'notEmpty',
  1886. '/^.{5,}$/s' => 'no matchy',
  1887. '/^[0-9A-Za-z \\.]{1,}$/s'
  1888. )
  1889. );
  1890. /**
  1891. * customValidationMethod method
  1892. *
  1893. * @param mixed $data
  1894. * @return void
  1895. */
  1896. public function customValidationMethod($data) {
  1897. return $data === 1;
  1898. }
  1899. /**
  1900. * Custom validator with parameters + default values
  1901. *
  1902. * @return array
  1903. */
  1904. public function customValidatorWithParams($data, $validator, $or = true, $ignoreOnSame = 'id') {
  1905. $this->validatorParams = get_defined_vars();
  1906. unset($this->validatorParams['this']);
  1907. return true;
  1908. }
  1909. /**
  1910. * Custom validator with message
  1911. *
  1912. * @return array
  1913. */
  1914. public function customValidatorWithMessage($data) {
  1915. return 'This field will *never* validate! Muhahaha!';
  1916. }
  1917. /**
  1918. * Test validation with many parameters
  1919. *
  1920. * @return void
  1921. */
  1922. public function customValidatorWithSixParams($data, $one = 1, $two = 2, $three = 3, $four = 4, $five = 5, $six = 6) {
  1923. $this->validatorParams = get_defined_vars();
  1924. unset($this->validatorParams['this']);
  1925. return true;
  1926. }
  1927. }
  1928. /**
  1929. * ValidationTest2 class
  1930. *
  1931. * @package Cake.Test.Case.Model
  1932. */
  1933. class ValidationTest2 extends CakeTestModel {
  1934. /**
  1935. * name property
  1936. *
  1937. * @var string
  1938. */
  1939. public $name = 'ValidationTest2';
  1940. /**
  1941. * useTable property
  1942. *
  1943. * @var bool false
  1944. */
  1945. public $useTable = false;
  1946. /**
  1947. * validate property
  1948. *
  1949. * @var array
  1950. */
  1951. public $validate = array(
  1952. 'title' => 'notEmpty',
  1953. 'published' => 'customValidationMethod',
  1954. 'body' => array(
  1955. 'notEmpty',
  1956. '/^.{5,}$/s' => 'no matchy',
  1957. '/^[0-9A-Za-z \\.]{1,}$/s'
  1958. )
  1959. );
  1960. /**
  1961. * customValidationMethod method
  1962. *
  1963. * @param mixed $data
  1964. * @return void
  1965. */
  1966. public function customValidationMethod($data) {
  1967. return $data === 1;
  1968. }
  1969. /**
  1970. * schema method
  1971. *
  1972. * @return void
  1973. */
  1974. public function schema($field = false) {
  1975. return array();
  1976. }
  1977. }
  1978. /**
  1979. * Person class
  1980. *
  1981. * @package Cake.Test.Case.Model
  1982. */
  1983. class Person extends CakeTestModel {
  1984. /**
  1985. * name property
  1986. *
  1987. * @var string
  1988. */
  1989. public $name = 'Person';
  1990. /**
  1991. * belongsTo property
  1992. *
  1993. * @var array
  1994. */
  1995. public $belongsTo = array(
  1996. 'Mother' => array(
  1997. 'className' => 'Person',
  1998. 'foreignKey' => 'mother_id'
  1999. ),
  2000. 'Father' => array(
  2001. 'className' => 'Person',
  2002. 'foreignKey' => 'father_id'
  2003. )
  2004. );
  2005. }
  2006. /**
  2007. * UnderscoreField class
  2008. *
  2009. * @package Cake.Test.Case.Model
  2010. */
  2011. class UnderscoreField extends CakeTestModel {
  2012. /**
  2013. * name property
  2014. *
  2015. * @var string
  2016. */
  2017. public $name = 'UnderscoreField';
  2018. }
  2019. /**
  2020. * Product class
  2021. *
  2022. * @package Cake.Test.Case.Model
  2023. */
  2024. class Product extends CakeTestModel {
  2025. /**
  2026. * name property
  2027. *
  2028. * @var string
  2029. */
  2030. public $name = 'Product';
  2031. }
  2032. /**
  2033. * Story class
  2034. *
  2035. * @package Cake.Test.Case.Model
  2036. */
  2037. class Story extends CakeTestModel {
  2038. /**
  2039. * name property
  2040. *
  2041. * @var string
  2042. */
  2043. public $name = 'Story';
  2044. /**
  2045. * primaryKey property
  2046. *
  2047. * @var string
  2048. */
  2049. public $primaryKey = 'story';
  2050. /**
  2051. * hasAndBelongsToMany property
  2052. *
  2053. * @var array
  2054. */
  2055. public $hasAndBelongsToMany = array('Tag' => array('foreignKey' => 'story'));
  2056. /**
  2057. * validate property
  2058. *
  2059. * @var array
  2060. */
  2061. public $validate = array('title' => 'notEmpty');
  2062. }
  2063. /**
  2064. * Cd class
  2065. *
  2066. * @package Cake.Test.Case.Model
  2067. */
  2068. class Cd extends CakeTestModel {
  2069. /**
  2070. * name property
  2071. *
  2072. * @var string
  2073. */
  2074. public $name = 'Cd';
  2075. /**
  2076. * hasOne property
  2077. *
  2078. * @var array
  2079. */
  2080. public $hasOne = array(
  2081. 'OverallFavorite' => array(
  2082. 'foreignKey' => 'model_id',
  2083. 'dependent' => true,
  2084. 'conditions' => array('model_type' => 'Cd')
  2085. )
  2086. );
  2087. }
  2088. /**
  2089. * Book class
  2090. *
  2091. * @package Cake.Test.Case.Model
  2092. */
  2093. class Book extends CakeTestModel {
  2094. /**
  2095. * name property
  2096. *
  2097. * @var string
  2098. */
  2099. public $name = 'Book';
  2100. /**
  2101. * hasOne property
  2102. *
  2103. * @var array
  2104. */
  2105. public $hasOne = array(
  2106. 'OverallFavorite' => array(
  2107. 'foreignKey' => 'model_id',
  2108. 'dependent' => true,
  2109. 'conditions' => 'OverallFavorite.model_type = \'Book\''
  2110. )
  2111. );
  2112. }
  2113. /**
  2114. * OverallFavorite class
  2115. *
  2116. * @package Cake.Test.Case.Model
  2117. */
  2118. class OverallFavorite extends CakeTestModel {
  2119. /**
  2120. * name property
  2121. *
  2122. * @var string
  2123. */
  2124. public $name = 'OverallFavorite';
  2125. }
  2126. /**
  2127. * MyUser class
  2128. *
  2129. * @package Cake.Test.Case.Model
  2130. */
  2131. class MyUser extends CakeTestModel {
  2132. /**
  2133. * name property
  2134. *
  2135. * @var string
  2136. */
  2137. public $name = 'MyUser';
  2138. /**
  2139. * undocumented variable
  2140. *
  2141. * @var string
  2142. */
  2143. public $hasAndBelongsToMany = array('MyCategory');
  2144. }
  2145. /**
  2146. * MyCategory class
  2147. *
  2148. * @package Cake.Test.Case.Model
  2149. */
  2150. class MyCategory extends CakeTestModel {
  2151. /**
  2152. * name property
  2153. *
  2154. * @var string
  2155. */
  2156. public $name = 'MyCategory';
  2157. /**
  2158. * undocumented variable
  2159. *
  2160. * @var string
  2161. */
  2162. public $hasAndBelongsToMany = array('MyProduct', 'MyUser');
  2163. }
  2164. /**
  2165. * MyProduct class
  2166. *
  2167. * @package Cake.Test.Case.Model
  2168. */
  2169. class MyProduct extends CakeTestModel {
  2170. /**
  2171. * name property
  2172. *
  2173. * @var string
  2174. */
  2175. public $name = 'MyProduct';
  2176. /**
  2177. * undocumented variable
  2178. *
  2179. * @var string
  2180. */
  2181. public $hasAndBelongsToMany = array('MyCategory');
  2182. }
  2183. /**
  2184. * MyCategoriesMyUser class
  2185. *
  2186. * @package Cake.Test.Case.Model
  2187. */
  2188. class MyCategoriesMyUser extends CakeTestModel {
  2189. /**
  2190. * name property
  2191. *
  2192. * @var string
  2193. */
  2194. public $name = 'MyCategoriesMyUser';
  2195. }
  2196. /**
  2197. * MyCategoriesMyProduct class
  2198. *
  2199. * @package Cake.Test.Case.Model
  2200. */
  2201. class MyCategoriesMyProduct extends CakeTestModel {
  2202. /**
  2203. * name property
  2204. *
  2205. * @var string
  2206. */
  2207. public $name = 'MyCategoriesMyProduct';
  2208. }
  2209. /**
  2210. * NumberTree class
  2211. *
  2212. * @package Cake.Test.Case.Model
  2213. */
  2214. class NumberTree extends CakeTestModel {
  2215. /**
  2216. * name property
  2217. *
  2218. * @var string
  2219. */
  2220. public $name = 'NumberTree';
  2221. /**
  2222. * actsAs property
  2223. *
  2224. * @var array
  2225. */
  2226. public $actsAs = array('Tree');
  2227. /**
  2228. * initialize method
  2229. *
  2230. * @param integer $levelLimit
  2231. * @param integer $childLimit
  2232. * @param mixed $currentLevel
  2233. * @param mixed $parent_id
  2234. * @param string $prefix
  2235. * @param boolean $hierarchal
  2236. * @return void
  2237. */
  2238. public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierarchal = true) {
  2239. if (!$parentId) {
  2240. $db = ConnectionManager::getDataSource($this->useDbConfig);
  2241. $db->truncate($this->table);
  2242. $this->save(array($this->name => array('name' => '1. Root')));
  2243. $this->initialize($levelLimit, $childLimit, 1, $this->id, '1', $hierarchal);
  2244. $this->create(array());
  2245. }
  2246. if (!$currentLevel || $currentLevel > $levelLimit) {
  2247. return;
  2248. }
  2249. for ($i = 1; $i <= $childLimit; $i++) {
  2250. $name = $prefix . '.' . $i;
  2251. $data = array($this->name => array('name' => $name));
  2252. $this->create($data);
  2253. if ($hierarchal) {
  2254. if ($this->name === 'UnconventionalTree') {
  2255. $data[$this->name]['join'] = $parentId;
  2256. } else {
  2257. $data[$this->name]['parent_id'] = $parentId;
  2258. }
  2259. }
  2260. $this->save($data);
  2261. $this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierarchal);
  2262. }
  2263. }
  2264. }
  2265. /**
  2266. * NumberTreeTwo class
  2267. *
  2268. * @package Cake.Test.Case.Model
  2269. */
  2270. class NumberTreeTwo extends NumberTree {
  2271. /**
  2272. * name property
  2273. *
  2274. * @var string
  2275. */
  2276. public $name = 'NumberTreeTwo';
  2277. /**
  2278. * actsAs property
  2279. *
  2280. * @var array
  2281. */
  2282. public $actsAs = array();
  2283. }
  2284. /**
  2285. * FlagTree class
  2286. *
  2287. * @package Cake.Test.Case.Model
  2288. */
  2289. class FlagTree extends NumberTree {
  2290. /**
  2291. * name property
  2292. *
  2293. * @var string
  2294. */
  2295. public $name = 'FlagTree';
  2296. }
  2297. /**
  2298. * UnconventionalTree class
  2299. *
  2300. * @package Cake.Test.Case.Model
  2301. */
  2302. class UnconventionalTree extends NumberTree {
  2303. /**
  2304. * name property
  2305. *
  2306. * @var string
  2307. */
  2308. public $name = 'UnconventionalTree';
  2309. public $actsAs = array(
  2310. 'Tree' => array(
  2311. 'parent' => 'join',
  2312. 'left' => 'left',
  2313. 'right' => 'right'
  2314. )
  2315. );
  2316. }
  2317. /**
  2318. * UuidTree class
  2319. *
  2320. * @package Cake.Test.Case.Model
  2321. */
  2322. class UuidTree extends NumberTree {
  2323. /**
  2324. * name property
  2325. *
  2326. * @var string
  2327. */
  2328. public $name = 'UuidTree';
  2329. }
  2330. /**
  2331. * Campaign class
  2332. *
  2333. * @package Cake.Test.Case.Model
  2334. */
  2335. class Campaign extends CakeTestModel {
  2336. /**
  2337. * name property
  2338. *
  2339. * @var string
  2340. */
  2341. public $name = 'Campaign';
  2342. /**
  2343. * hasMany property
  2344. *
  2345. * @var array
  2346. */
  2347. public $hasMany = array('Ad' => array('fields' => array('id', 'campaign_id', 'name')));
  2348. }
  2349. /**
  2350. * Ad class
  2351. *
  2352. * @package Cake.Test.Case.Model
  2353. */
  2354. class Ad extends CakeTestModel {
  2355. /**
  2356. * name property
  2357. *
  2358. * @var string
  2359. */
  2360. public $name = 'Ad';
  2361. /**
  2362. * actsAs property
  2363. *
  2364. * @var array
  2365. */
  2366. public $actsAs = array('Tree');
  2367. /**
  2368. * belongsTo property
  2369. *
  2370. * @var array
  2371. */
  2372. public $belongsTo = array('Campaign');
  2373. }
  2374. /**
  2375. * AfterTree class
  2376. *
  2377. * @package Cake.Test.Case.Model
  2378. */
  2379. class AfterTree extends NumberTree {
  2380. /**
  2381. * name property
  2382. *
  2383. * @var string
  2384. */
  2385. public $name = 'AfterTree';
  2386. /**
  2387. * actsAs property
  2388. *
  2389. * @var array
  2390. */
  2391. public $actsAs = array('Tree');
  2392. public function afterSave($created) {
  2393. if ($created && isset($this->data['AfterTree'])) {
  2394. $this->data['AfterTree']['name'] = 'Six and One Half Changed in AfterTree::afterSave() but not in database';
  2395. }
  2396. }
  2397. }
  2398. /**
  2399. * Nonconformant Content class
  2400. *
  2401. * @package Cake.Test.Case.Model
  2402. */
  2403. class Content extends CakeTestModel {
  2404. /**
  2405. * name property
  2406. *
  2407. * @var string
  2408. */
  2409. public $name = 'Content';
  2410. /**
  2411. * useTable property
  2412. *
  2413. * @var string
  2414. */
  2415. public $useTable = 'Content';
  2416. /**
  2417. * primaryKey property
  2418. *
  2419. * @var string
  2420. */
  2421. public $primaryKey = 'iContentId';
  2422. /**
  2423. * hasAndBelongsToMany property
  2424. *
  2425. * @var array
  2426. */
  2427. public $hasAndBelongsToMany = array('Account' => array('className' => 'Account', 'with' => 'ContentAccount', 'joinTable' => 'ContentAccounts', 'foreignKey' => 'iContentId', 'associationForeignKey', 'iAccountId'));
  2428. }
  2429. /**
  2430. * Nonconformant Account class
  2431. *
  2432. * @package Cake.Test.Case.Model
  2433. */
  2434. class Account extends CakeTestModel {
  2435. /**
  2436. * name property
  2437. *
  2438. * @var string
  2439. */
  2440. public $name = 'Account';
  2441. /**
  2442. * useTable property
  2443. *
  2444. * @var string
  2445. */
  2446. public $useTable = 'Accounts';
  2447. /**
  2448. * primaryKey property
  2449. *
  2450. * @var string
  2451. */
  2452. public $primaryKey = 'iAccountId';
  2453. }
  2454. /**
  2455. * Nonconformant ContentAccount class
  2456. *
  2457. * @package Cake.Test.Case.Model
  2458. */
  2459. class ContentAccount extends CakeTestModel {
  2460. /**
  2461. * name property
  2462. *
  2463. * @var string
  2464. */
  2465. public $name = 'ContentAccount';
  2466. /**
  2467. * useTable property
  2468. *
  2469. * @var string
  2470. */
  2471. public $useTable = 'ContentAccounts';
  2472. /**
  2473. * primaryKey property
  2474. *
  2475. * @var string
  2476. */
  2477. public $primaryKey = 'iContentAccountsId';
  2478. }
  2479. /**
  2480. * FilmFile class
  2481. *
  2482. * @package Cake.Test.Case.Model
  2483. */
  2484. class FilmFile extends CakeTestModel {
  2485. public $name = 'FilmFile';
  2486. }
  2487. /**
  2488. * Basket test model
  2489. *
  2490. * @package Cake.Test.Case.Model
  2491. */
  2492. class Basket extends CakeTestModel {
  2493. public $name = 'Basket';
  2494. public $belongsTo = array(
  2495. 'FilmFile' => array(
  2496. 'className' => 'FilmFile',
  2497. 'foreignKey' => 'object_id',
  2498. 'conditions' => "Basket.type = 'file'",
  2499. 'fields' => '',
  2500. 'order' => ''
  2501. )
  2502. );
  2503. }
  2504. /**
  2505. * TestPluginArticle class
  2506. *
  2507. * @package Cake.Test.Case.Model
  2508. */
  2509. class TestPluginArticle extends CakeTestModel {
  2510. /**
  2511. * name property
  2512. *
  2513. * @var string
  2514. */
  2515. public $name = 'TestPluginArticle';
  2516. /**
  2517. * belongsTo property
  2518. *
  2519. * @var array
  2520. */
  2521. public $belongsTo = array('User');
  2522. /**
  2523. * hasMany property
  2524. *
  2525. * @var array
  2526. */
  2527. public $hasMany = array(
  2528. 'TestPluginComment' => array(
  2529. 'className' => 'TestPlugin.TestPluginComment',
  2530. 'foreignKey' => 'article_id',
  2531. 'dependent' => true
  2532. )
  2533. );
  2534. }
  2535. /**
  2536. * TestPluginComment class
  2537. *
  2538. * @package Cake.Test.Case.Model
  2539. */
  2540. class TestPluginComment extends CakeTestModel {
  2541. /**
  2542. * name property
  2543. *
  2544. * @var string
  2545. */
  2546. public $name = 'TestPluginComment';
  2547. /**
  2548. * belongsTo property
  2549. *
  2550. * @var array
  2551. */
  2552. public $belongsTo = array(
  2553. 'TestPluginArticle' => array(
  2554. 'className' => 'TestPlugin.TestPluginArticle',
  2555. 'foreignKey' => 'article_id',
  2556. ),
  2557. 'TestPlugin.User'
  2558. );
  2559. }
  2560. /**
  2561. * Uuidportfolio class
  2562. *
  2563. * @package Cake.Test.Case.Model
  2564. */
  2565. class Uuidportfolio extends CakeTestModel {
  2566. /**
  2567. * name property
  2568. *
  2569. * @var string
  2570. */
  2571. public $name = 'Uuidportfolio';
  2572. /**
  2573. * hasAndBelongsToMany property
  2574. *
  2575. * @var array
  2576. */
  2577. public $hasAndBelongsToMany = array('Uuiditem');
  2578. }
  2579. /**
  2580. * Uuiditem class
  2581. *
  2582. * @package Cake.Test.Case.Model
  2583. */
  2584. class Uuiditem extends CakeTestModel {
  2585. /**
  2586. * name property
  2587. *
  2588. * @var string
  2589. */
  2590. public $name = 'Uuiditem';
  2591. /**
  2592. * hasAndBelongsToMany property
  2593. *
  2594. * @var array
  2595. */
  2596. public $hasAndBelongsToMany = array('Uuidportfolio' => array('with' => 'UuiditemsUuidportfolioNumericid'));
  2597. }
  2598. /**
  2599. * UuiditemsPortfolio class
  2600. *
  2601. * @package Cake.Test.Case.Model
  2602. */
  2603. class UuiditemsUuidportfolio extends CakeTestModel {
  2604. /**
  2605. * name property
  2606. *
  2607. * @var string
  2608. */
  2609. public $name = 'UuiditemsUuidportfolio';
  2610. }
  2611. /**
  2612. * UuiditemsPortfolioNumericid class
  2613. *
  2614. * @package Cake.Test.Case.Model
  2615. */
  2616. class UuiditemsUuidportfolioNumericid extends CakeTestModel {
  2617. /**
  2618. * name property
  2619. *
  2620. * @var string
  2621. */
  2622. public $name = 'UuiditemsUuidportfolioNumericid';
  2623. }
  2624. /**
  2625. * TranslateTestModel class.
  2626. *
  2627. * @package Cake.Test.Case.Model
  2628. */
  2629. class TranslateTestModel extends CakeTestModel {
  2630. /**
  2631. * name property
  2632. *
  2633. * @var string
  2634. */
  2635. public $name = 'TranslateTestModel';
  2636. /**
  2637. * useTable property
  2638. *
  2639. * @var string
  2640. */
  2641. public $useTable = 'i18n';
  2642. /**
  2643. * displayField property
  2644. *
  2645. * @var string
  2646. */
  2647. public $displayField = 'field';
  2648. }
  2649. /**
  2650. * TranslateTestModel class.
  2651. *
  2652. * @package Cake.Test.Case.Model
  2653. */
  2654. class TranslateWithPrefix extends CakeTestModel {
  2655. /**
  2656. * name property
  2657. *
  2658. * @var string
  2659. */
  2660. public $name = 'TranslateWithPrefix';
  2661. /**
  2662. * tablePrefix property
  2663. *
  2664. * @var string
  2665. */
  2666. public $tablePrefix = 'i18n_';
  2667. /**
  2668. * displayField property
  2669. *
  2670. * @var string
  2671. */
  2672. public $displayField = 'field';
  2673. }
  2674. /**
  2675. * TranslatedItem class.
  2676. *
  2677. * @package Cake.Test.Case.Model
  2678. */
  2679. class TranslatedItem extends CakeTestModel {
  2680. /**
  2681. * name property
  2682. *
  2683. * @var string
  2684. */
  2685. public $name = 'TranslatedItem';
  2686. /**
  2687. * cacheQueries property
  2688. *
  2689. * @var bool false
  2690. */
  2691. public $cacheQueries = false;
  2692. /**
  2693. * actsAs property
  2694. *
  2695. * @var array
  2696. */
  2697. public $actsAs = array('Translate' => array('content', 'title'));
  2698. /**
  2699. * translateModel property
  2700. *
  2701. * @var string
  2702. */
  2703. public $translateModel = 'TranslateTestModel';
  2704. }
  2705. /**
  2706. * TranslatedItem class.
  2707. *
  2708. * @package Cake.Test.Case.Model
  2709. */
  2710. class TranslatedItem2 extends CakeTestModel {
  2711. /**
  2712. * name property
  2713. *
  2714. * @var string
  2715. */
  2716. public $name = 'TranslatedItem';
  2717. /**
  2718. * cacheQueries property
  2719. *
  2720. * @var bool false
  2721. */
  2722. public $cacheQueries = false;
  2723. /**
  2724. * actsAs property
  2725. *
  2726. * @var array
  2727. */
  2728. public $actsAs = array('Translate' => array('content', 'title'));
  2729. /**
  2730. * translateModel property
  2731. *
  2732. * @var string
  2733. */
  2734. public $translateModel = 'TranslateWithPrefix';
  2735. }
  2736. /**
  2737. * TranslatedItemWithTable class.
  2738. *
  2739. * @package Cake.Test.Case.Model
  2740. */
  2741. class TranslatedItemWithTable extends CakeTestModel {
  2742. /**
  2743. * name property
  2744. *
  2745. * @var string
  2746. */
  2747. public $name = 'TranslatedItemWithTable';
  2748. /**
  2749. * useTable property
  2750. *
  2751. * @var string
  2752. */
  2753. public $useTable = 'translated_items';
  2754. /**
  2755. * cacheQueries property
  2756. *
  2757. * @var bool false
  2758. */
  2759. public $cacheQueries = false;
  2760. /**
  2761. * actsAs property
  2762. *
  2763. * @var array
  2764. */
  2765. public $actsAs = array('Translate' => array('content', 'title'));
  2766. /**
  2767. * translateModel property
  2768. *
  2769. * @var string
  2770. */
  2771. public $translateModel = 'TranslateTestModel';
  2772. /**
  2773. * translateTable property
  2774. *
  2775. * @var string
  2776. */
  2777. public $translateTable = 'another_i18n';
  2778. }
  2779. /**
  2780. * TranslateArticleModel class.
  2781. *
  2782. * @package Cake.Test.Case.Model
  2783. */
  2784. class TranslateArticleModel extends CakeTestModel {
  2785. /**
  2786. * name property
  2787. *
  2788. * @var string
  2789. */
  2790. public $name = 'TranslateArticleModel';
  2791. /**
  2792. * useTable property
  2793. *
  2794. * @var string
  2795. */
  2796. public $useTable = 'article_i18n';
  2797. /**
  2798. * displayField property
  2799. *
  2800. * @var string
  2801. */
  2802. public $displayField = 'field';
  2803. }
  2804. /**
  2805. * TranslatedArticle class.
  2806. *
  2807. * @package Cake.Test.Case.Model
  2808. */
  2809. class TranslatedArticle extends CakeTestModel {
  2810. /**
  2811. * name property
  2812. *
  2813. * @var string
  2814. */
  2815. public $name = 'TranslatedArticle';
  2816. /**
  2817. * cacheQueries property
  2818. *
  2819. * @var bool false
  2820. */
  2821. public $cacheQueries = false;
  2822. /**
  2823. * actsAs property
  2824. *
  2825. * @var array
  2826. */
  2827. public $actsAs = array('Translate' => array('title', 'body'));
  2828. /**
  2829. * translateModel property
  2830. *
  2831. * @var string
  2832. */
  2833. public $translateModel = 'TranslateArticleModel';
  2834. /**
  2835. * belongsTo property
  2836. *
  2837. * @var array
  2838. */
  2839. public $belongsTo = array('User');
  2840. /**
  2841. * belongsTo property
  2842. *
  2843. * @var array
  2844. */
  2845. public $hasMany = array('TranslatedItem');
  2846. }
  2847. class CounterCacheUser extends CakeTestModel {
  2848. public $name = 'CounterCacheUser';
  2849. public $alias = 'User';
  2850. public $hasMany = array(
  2851. 'Post' => array(
  2852. 'className' => 'CounterCachePost',
  2853. 'foreignKey' => 'user_id'
  2854. )
  2855. );
  2856. }
  2857. class CounterCachePost extends CakeTestModel {
  2858. public $name = 'CounterCachePost';
  2859. public $alias = 'Post';
  2860. public $belongsTo = array(
  2861. 'User' => array(
  2862. 'className' => 'CounterCacheUser',
  2863. 'foreignKey' => 'user_id',
  2864. 'counterCache' => true
  2865. )
  2866. );
  2867. }
  2868. class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
  2869. public $name = 'CounterCacheUserNonstandardPrimaryKey';
  2870. public $alias = 'User';
  2871. public $primaryKey = 'uid';
  2872. public $hasMany = array(
  2873. 'Post' => array(
  2874. 'className' => 'CounterCachePostNonstandardPrimaryKey',
  2875. 'foreignKey' => 'uid'
  2876. )
  2877. );
  2878. }
  2879. class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
  2880. public $name = 'CounterCachePostNonstandardPrimaryKey';
  2881. public $alias = 'Post';
  2882. public $primaryKey = 'pid';
  2883. public $belongsTo = array(
  2884. 'User' => array(
  2885. 'className' => 'CounterCacheUserNonstandardPrimaryKey',
  2886. 'foreignKey' => 'uid',
  2887. 'counterCache' => true
  2888. )
  2889. );
  2890. }
  2891. class ArticleB extends CakeTestModel {
  2892. public $name = 'ArticleB';
  2893. public $useTable = 'articles';
  2894. public $hasAndBelongsToMany = array(
  2895. 'TagB' => array(
  2896. 'className' => 'TagB',
  2897. 'joinTable' => 'articles_tags',
  2898. 'foreignKey' => 'article_id',
  2899. 'associationForeignKey' => 'tag_id'
  2900. )
  2901. );
  2902. }
  2903. class TagB extends CakeTestModel {
  2904. public $name = 'TagB';
  2905. public $useTable = 'tags';
  2906. public $hasAndBelongsToMany = array(
  2907. 'ArticleB' => array(
  2908. 'className' => 'ArticleB',
  2909. 'joinTable' => 'articles_tags',
  2910. 'foreignKey' => 'tag_id',
  2911. 'associationForeignKey' => 'article_id'
  2912. )
  2913. );
  2914. }
  2915. class Fruit extends CakeTestModel {
  2916. public $name = 'Fruit';
  2917. public $hasAndBelongsToMany = array(
  2918. 'UuidTag' => array(
  2919. 'className' => 'UuidTag',
  2920. 'joinTable' => 'fruits_uuid_tags',
  2921. 'foreignKey' => 'fruit_id',
  2922. 'associationForeignKey' => 'uuid_tag_id',
  2923. 'with' => 'FruitsUuidTag'
  2924. )
  2925. );
  2926. }
  2927. class FruitsUuidTag extends CakeTestModel {
  2928. public $name = 'FruitsUuidTag';
  2929. public $primaryKey = false;
  2930. public $belongsTo = array(
  2931. 'UuidTag' => array(
  2932. 'className' => 'UuidTag',
  2933. 'foreignKey' => 'uuid_tag_id',
  2934. ),
  2935. 'Fruit' => array(
  2936. 'className' => 'Fruit',
  2937. 'foreignKey' => 'fruit_id',
  2938. )
  2939. );
  2940. }
  2941. class UuidTag extends CakeTestModel {
  2942. public $name = 'UuidTag';
  2943. public $hasAndBelongsToMany = array(
  2944. 'Fruit' => array(
  2945. 'className' => 'Fruit',
  2946. 'joinTable' => 'fruits_uuid_tags',
  2947. 'foreign_key' => 'uuid_tag_id',
  2948. 'associationForeignKey' => 'fruit_id',
  2949. 'with' => 'FruitsUuidTag'
  2950. )
  2951. );
  2952. }
  2953. class FruitNoWith extends CakeTestModel {
  2954. public $name = 'Fruit';
  2955. public $useTable = 'fruits';
  2956. public $hasAndBelongsToMany = array(
  2957. 'UuidTag' => array(
  2958. 'className' => 'UuidTagNoWith',
  2959. 'joinTable' => 'fruits_uuid_tags',
  2960. 'foreignKey' => 'fruit_id',
  2961. 'associationForeignKey' => 'uuid_tag_id',
  2962. )
  2963. );
  2964. }
  2965. class UuidTagNoWith extends CakeTestModel {
  2966. public $name = 'UuidTag';
  2967. public $useTable = 'uuid_tags';
  2968. public $hasAndBelongsToMany = array(
  2969. 'Fruit' => array(
  2970. 'className' => 'FruitNoWith',
  2971. 'joinTable' => 'fruits_uuid_tags',
  2972. 'foreign_key' => 'uuid_tag_id',
  2973. 'associationForeignKey' => 'fruit_id',
  2974. )
  2975. );
  2976. }
  2977. class ProductUpdateAll extends CakeTestModel {
  2978. public $name = 'ProductUpdateAll';
  2979. public $useTable = 'product_update_all';
  2980. }
  2981. class GroupUpdateAll extends CakeTestModel {
  2982. public $name = 'GroupUpdateAll';
  2983. public $useTable = 'group_update_all';
  2984. }
  2985. class TransactionTestModel extends CakeTestModel {
  2986. public $name = 'TransactionTestModel';
  2987. public $useTable = 'samples';
  2988. public function afterSave($created) {
  2989. $data = array(
  2990. array('apple_id' => 1, 'name' => 'sample6'),
  2991. );
  2992. $this->saveAll($data, array('atomic' => true, 'callbacks' => false));
  2993. }
  2994. }
  2995. class TransactionManyTestModel extends CakeTestModel {
  2996. public $name = 'TransactionManyTestModel';
  2997. public $useTable = 'samples';
  2998. public function afterSave($created) {
  2999. $data = array(
  3000. array('apple_id' => 1, 'name' => 'sample6'),
  3001. );
  3002. $this->saveMany($data, array('atomic' => true, 'callbacks' => false));
  3003. }
  3004. }
  3005. class Site extends CakeTestModel {
  3006. public $name = 'Site';
  3007. public $useTable = 'sites';
  3008. public $hasAndBelongsToMany = array(
  3009. 'Domain' => array('unique' => 'keepExisting'),
  3010. );
  3011. }
  3012. class Domain extends CakeTestModel {
  3013. public $name = 'Domain';
  3014. public $useTable = 'domains';
  3015. public $hasAndBelongsToMany = array(
  3016. 'Site' => array('unique' => 'keepExisting'),
  3017. );
  3018. }
  3019. /**
  3020. * TestModel class
  3021. *
  3022. * @package Cake.Test.Case.Model
  3023. */
  3024. class TestModel extends CakeTestModel {
  3025. /**
  3026. * name property
  3027. *
  3028. * @var string
  3029. */
  3030. public $name = 'TestModel';
  3031. /**
  3032. * useTable property
  3033. *
  3034. * @var bool false
  3035. */
  3036. public $useTable = false;
  3037. /**
  3038. * schema property
  3039. *
  3040. * @var array
  3041. */
  3042. protected $_schema = array(
  3043. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3044. 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
  3045. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3046. 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3047. 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  3048. 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  3049. 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
  3050. 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3051. 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3052. 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3053. 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3054. 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3055. 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  3056. 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3057. 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => '155'),
  3058. 'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
  3059. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3060. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3061. );
  3062. /**
  3063. * find method
  3064. *
  3065. * @param mixed $conditions
  3066. * @param mixed $fields
  3067. * @param mixed $order
  3068. * @param mixed $recursive
  3069. * @return void
  3070. */
  3071. public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
  3072. return array($conditions, $fields);
  3073. }
  3074. /**
  3075. * findAll method
  3076. *
  3077. * @param mixed $conditions
  3078. * @param mixed $fields
  3079. * @param mixed $order
  3080. * @param mixed $recursive
  3081. * @return void
  3082. */
  3083. public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
  3084. return $conditions;
  3085. }
  3086. }
  3087. /**
  3088. * TestModel2 class
  3089. *
  3090. * @package Cake.Test.Case.Model
  3091. */
  3092. class TestModel2 extends CakeTestModel {
  3093. /**
  3094. * name property
  3095. *
  3096. * @var string
  3097. */
  3098. public $name = 'TestModel2';
  3099. /**
  3100. * useTable property
  3101. *
  3102. * @var bool false
  3103. */
  3104. public $useTable = false;
  3105. }
  3106. /**
  3107. * TestModel4 class
  3108. *
  3109. * @package Cake.Test.Case.Model
  3110. */
  3111. class TestModel3 extends CakeTestModel {
  3112. /**
  3113. * name property
  3114. *
  3115. * @var string
  3116. */
  3117. public $name = 'TestModel3';
  3118. /**
  3119. * useTable property
  3120. *
  3121. * @var bool false
  3122. */
  3123. public $useTable = false;
  3124. }
  3125. /**
  3126. * TestModel4 class
  3127. *
  3128. * @package Cake.Test.Case.Model
  3129. */
  3130. class TestModel4 extends CakeTestModel {
  3131. /**
  3132. * name property
  3133. *
  3134. * @var string
  3135. */
  3136. public $name = 'TestModel4';
  3137. /**
  3138. * table property
  3139. *
  3140. * @var string
  3141. */
  3142. public $table = 'test_model4';
  3143. /**
  3144. * useTable property
  3145. *
  3146. * @var bool false
  3147. */
  3148. public $useTable = false;
  3149. /**
  3150. * belongsTo property
  3151. *
  3152. * @var array
  3153. */
  3154. public $belongsTo = array(
  3155. 'TestModel4Parent' => array(
  3156. 'className' => 'TestModel4',
  3157. 'foreignKey' => 'parent_id'
  3158. )
  3159. );
  3160. /**
  3161. * hasOne property
  3162. *
  3163. * @var array
  3164. */
  3165. public $hasOne = array(
  3166. 'TestModel5' => array(
  3167. 'className' => 'TestModel5',
  3168. 'foreignKey' => 'test_model4_id'
  3169. )
  3170. );
  3171. /**
  3172. * hasAndBelongsToMany property
  3173. *
  3174. * @var array
  3175. */
  3176. public $hasAndBelongsToMany = array('TestModel7' => array(
  3177. 'className' => 'TestModel7',
  3178. 'joinTable' => 'test_model4_test_model7',
  3179. 'foreignKey' => 'test_model4_id',
  3180. 'associationForeignKey' => 'test_model7_id',
  3181. 'with' => 'TestModel4TestModel7'
  3182. ));
  3183. /**
  3184. * schema method
  3185. *
  3186. * @return void
  3187. */
  3188. public function schema($field = false) {
  3189. if (!isset($this->_schema)) {
  3190. $this->_schema = array(
  3191. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3192. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3193. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3194. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3195. );
  3196. }
  3197. return $this->_schema;
  3198. }
  3199. }
  3200. /**
  3201. * TestModel4TestModel7 class
  3202. *
  3203. * @package Cake.Test.Case.Model
  3204. */
  3205. class TestModel4TestModel7 extends CakeTestModel {
  3206. /**
  3207. * name property
  3208. *
  3209. * @var string
  3210. */
  3211. public $name = 'TestModel4TestModel7';
  3212. /**
  3213. * table property
  3214. *
  3215. * @var string
  3216. */
  3217. public $table = 'test_model4_test_model7';
  3218. /**
  3219. * useTable property
  3220. *
  3221. * @var bool false
  3222. */
  3223. public $useTable = false;
  3224. /**
  3225. * schema method
  3226. *
  3227. * @return void
  3228. */
  3229. public function schema($field = false) {
  3230. if (!isset($this->_schema)) {
  3231. $this->_schema = array(
  3232. 'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3233. 'test_model7_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8')
  3234. );
  3235. }
  3236. return $this->_schema;
  3237. }
  3238. }
  3239. /**
  3240. * TestModel5 class
  3241. *
  3242. * @package Cake.Test.Case.Model
  3243. */
  3244. class TestModel5 extends CakeTestModel {
  3245. /**
  3246. * name property
  3247. *
  3248. * @var string
  3249. */
  3250. public $name = 'TestModel5';
  3251. /**
  3252. * table property
  3253. *
  3254. * @var string
  3255. */
  3256. public $table = 'test_model5';
  3257. /**
  3258. * useTable property
  3259. *
  3260. * @var bool false
  3261. */
  3262. public $useTable = false;
  3263. /**
  3264. * belongsTo property
  3265. *
  3266. * @var array
  3267. */
  3268. public $belongsTo = array('TestModel4' => array(
  3269. 'className' => 'TestModel4',
  3270. 'foreignKey' => 'test_model4_id'
  3271. ));
  3272. /**
  3273. * hasMany property
  3274. *
  3275. * @var array
  3276. */
  3277. public $hasMany = array('TestModel6' => array(
  3278. 'className' => 'TestModel6',
  3279. 'foreignKey' => 'test_model5_id'
  3280. ));
  3281. /**
  3282. * schema method
  3283. *
  3284. * @return void
  3285. */
  3286. public function schema($field = false) {
  3287. if (!isset($this->_schema)) {
  3288. $this->_schema = array(
  3289. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3290. 'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3291. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3292. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3293. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3294. );
  3295. }
  3296. return $this->_schema;
  3297. }
  3298. }
  3299. /**
  3300. * TestModel6 class
  3301. *
  3302. * @package Cake.Test.Case.Model
  3303. */
  3304. class TestModel6 extends CakeTestModel {
  3305. /**
  3306. * name property
  3307. *
  3308. * @var string
  3309. */
  3310. public $name = 'TestModel6';
  3311. /**
  3312. * table property
  3313. *
  3314. * @var string
  3315. */
  3316. public $table = 'test_model6';
  3317. /**
  3318. * useTable property
  3319. *
  3320. * @var bool false
  3321. */
  3322. public $useTable = false;
  3323. /**
  3324. * belongsTo property
  3325. *
  3326. * @var array
  3327. */
  3328. public $belongsTo = array(
  3329. 'TestModel5' => array(
  3330. 'className' => 'TestModel5',
  3331. 'foreignKey' => 'test_model5_id'
  3332. )
  3333. );
  3334. /**
  3335. * schema method
  3336. *
  3337. * @return void
  3338. */
  3339. public function schema($field = false) {
  3340. if (!isset($this->_schema)) {
  3341. $this->_schema = array(
  3342. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3343. 'test_model5_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3344. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3345. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3346. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3347. );
  3348. }
  3349. return $this->_schema;
  3350. }
  3351. }
  3352. /**
  3353. * TestModel7 class
  3354. *
  3355. * @package Cake.Test.Case.Model
  3356. */
  3357. class TestModel7 extends CakeTestModel {
  3358. /**
  3359. * name property
  3360. *
  3361. * @var string
  3362. */
  3363. public $name = 'TestModel7';
  3364. /**
  3365. * table property
  3366. *
  3367. * @var string
  3368. */
  3369. public $table = 'test_model7';
  3370. /**
  3371. * useTable property
  3372. *
  3373. * @var bool false
  3374. */
  3375. public $useTable = false;
  3376. /**
  3377. * schema method
  3378. *
  3379. * @return void
  3380. */
  3381. public function schema($field = false) {
  3382. if (!isset($this->_schema)) {
  3383. $this->_schema = array(
  3384. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3385. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3386. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3387. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3388. );
  3389. }
  3390. return $this->_schema;
  3391. }
  3392. }
  3393. /**
  3394. * TestModel8 class
  3395. *
  3396. * @package Cake.Test.Case.Model
  3397. */
  3398. class TestModel8 extends CakeTestModel {
  3399. /**
  3400. * name property
  3401. *
  3402. * @var string
  3403. */
  3404. public $name = 'TestModel8';
  3405. /**
  3406. * table property
  3407. *
  3408. * @var string
  3409. */
  3410. public $table = 'test_model8';
  3411. /**
  3412. * useTable property
  3413. *
  3414. * @var bool false
  3415. */
  3416. public $useTable = false;
  3417. /**
  3418. * hasOne property
  3419. *
  3420. * @var array
  3421. */
  3422. public $hasOne = array(
  3423. 'TestModel9' => array(
  3424. 'className' => 'TestModel9',
  3425. 'foreignKey' => 'test_model8_id',
  3426. 'conditions' => 'TestModel9.name != \'mariano\''
  3427. )
  3428. );
  3429. /**
  3430. * schema method
  3431. *
  3432. * @return void
  3433. */
  3434. public function schema($field = false) {
  3435. if (!isset($this->_schema)) {
  3436. $this->_schema = array(
  3437. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3438. 'test_model9_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3439. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3440. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3441. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3442. );
  3443. }
  3444. return $this->_schema;
  3445. }
  3446. }
  3447. /**
  3448. * TestModel9 class
  3449. *
  3450. * @package Cake.Test.Case.Model
  3451. */
  3452. class TestModel9 extends CakeTestModel {
  3453. /**
  3454. * name property
  3455. *
  3456. * @var string
  3457. */
  3458. public $name = 'TestModel9';
  3459. /**
  3460. * table property
  3461. *
  3462. * @var string
  3463. */
  3464. public $table = 'test_model9';
  3465. /**
  3466. * useTable property
  3467. *
  3468. * @var bool false
  3469. */
  3470. public $useTable = false;
  3471. /**
  3472. * belongsTo property
  3473. *
  3474. * @var array
  3475. */
  3476. public $belongsTo = array(
  3477. 'TestModel8' => array(
  3478. 'className' => 'TestModel8',
  3479. 'foreignKey' => 'test_model8_id',
  3480. 'conditions' => 'TestModel8.name != \'larry\''
  3481. )
  3482. );
  3483. /**
  3484. * schema method
  3485. *
  3486. * @return void
  3487. */
  3488. public function schema($field = false) {
  3489. if (!isset($this->_schema)) {
  3490. $this->_schema = array(
  3491. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3492. 'test_model8_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
  3493. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3494. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3495. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3496. );
  3497. }
  3498. return $this->_schema;
  3499. }
  3500. }
  3501. /**
  3502. * Level class
  3503. *
  3504. * @package Cake.Test.Case.Model
  3505. */
  3506. class Level extends CakeTestModel {
  3507. /**
  3508. * name property
  3509. *
  3510. * @var string
  3511. */
  3512. public $name = 'Level';
  3513. /**
  3514. * table property
  3515. *
  3516. * @var string
  3517. */
  3518. public $table = 'level';
  3519. /**
  3520. * useTable property
  3521. *
  3522. * @var bool false
  3523. */
  3524. public $useTable = false;
  3525. /**
  3526. * hasMany property
  3527. *
  3528. * @var array
  3529. */
  3530. public $hasMany = array(
  3531. 'Group' => array(
  3532. 'className' => 'Group'
  3533. ),
  3534. 'User2' => array(
  3535. 'className' => 'User2'
  3536. )
  3537. );
  3538. /**
  3539. * schema method
  3540. *
  3541. * @return void
  3542. */
  3543. public function schema($field = false) {
  3544. if (!isset($this->_schema)) {
  3545. $this->_schema = array(
  3546. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3547. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  3548. );
  3549. }
  3550. return $this->_schema;
  3551. }
  3552. }
  3553. /**
  3554. * Group class
  3555. *
  3556. * @package Cake.Test.Case.Model
  3557. */
  3558. class Group extends CakeTestModel {
  3559. /**
  3560. * name property
  3561. *
  3562. * @var string
  3563. */
  3564. public $name = 'Group';
  3565. /**
  3566. * table property
  3567. *
  3568. * @var string
  3569. */
  3570. public $table = 'group';
  3571. /**
  3572. * useTable property
  3573. *
  3574. * @var bool false
  3575. */
  3576. public $useTable = false;
  3577. /**
  3578. * belongsTo property
  3579. *
  3580. * @var array
  3581. */
  3582. public $belongsTo = array('Level');
  3583. /**
  3584. * hasMany property
  3585. *
  3586. * @var array
  3587. */
  3588. public $hasMany = array('Category2', 'User2');
  3589. /**
  3590. * schema method
  3591. *
  3592. * @return void
  3593. */
  3594. public function schema($field = false) {
  3595. if (!isset($this->_schema)) {
  3596. $this->_schema = array(
  3597. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3598. 'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3599. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  3600. );
  3601. }
  3602. return $this->_schema;
  3603. }
  3604. }
  3605. /**
  3606. * User2 class
  3607. *
  3608. * @package Cake.Test.Case.Model
  3609. */
  3610. class User2 extends CakeTestModel {
  3611. /**
  3612. * name property
  3613. *
  3614. * @var string
  3615. */
  3616. public $name = 'User2';
  3617. /**
  3618. * table property
  3619. *
  3620. * @var string
  3621. */
  3622. public $table = 'user';
  3623. /**
  3624. * useTable property
  3625. *
  3626. * @var bool false
  3627. */
  3628. public $useTable = false;
  3629. /**
  3630. * belongsTo property
  3631. *
  3632. * @var array
  3633. */
  3634. public $belongsTo = array(
  3635. 'Group' => array(
  3636. 'className' => 'Group'
  3637. ),
  3638. 'Level' => array(
  3639. 'className' => 'Level'
  3640. )
  3641. );
  3642. /**
  3643. * hasMany property
  3644. *
  3645. * @var array
  3646. */
  3647. public $hasMany = array(
  3648. 'Article2' => array(
  3649. 'className' => 'Article2'
  3650. ),
  3651. );
  3652. /**
  3653. * schema method
  3654. *
  3655. * @return void
  3656. */
  3657. public function schema($field = false) {
  3658. if (!isset($this->_schema)) {
  3659. $this->_schema = array(
  3660. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3661. 'group_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3662. 'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3663. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  3664. );
  3665. }
  3666. return $this->_schema;
  3667. }
  3668. }
  3669. /**
  3670. * Category2 class
  3671. *
  3672. * @package Cake.Test.Case.Model
  3673. */
  3674. class Category2 extends CakeTestModel {
  3675. /**
  3676. * name property
  3677. *
  3678. * @var string
  3679. */
  3680. public $name = 'Category2';
  3681. /**
  3682. * table property
  3683. *
  3684. * @var string
  3685. */
  3686. public $table = 'category';
  3687. /**
  3688. * useTable property
  3689. *
  3690. * @var bool false
  3691. */
  3692. public $useTable = false;
  3693. /**
  3694. * belongsTo property
  3695. *
  3696. * @var array
  3697. */
  3698. public $belongsTo = array(
  3699. 'Group' => array(
  3700. 'className' => 'Group',
  3701. 'foreignKey' => 'group_id'
  3702. ),
  3703. 'ParentCat' => array(
  3704. 'className' => 'Category2',
  3705. 'foreignKey' => 'parent_id'
  3706. )
  3707. );
  3708. /**
  3709. * hasMany property
  3710. *
  3711. * @var array
  3712. */
  3713. public $hasMany = array(
  3714. 'ChildCat' => array(
  3715. 'className' => 'Category2',
  3716. 'foreignKey' => 'parent_id'
  3717. ),
  3718. 'Article2' => array(
  3719. 'className' => 'Article2',
  3720. 'order' => 'Article2.published_date DESC',
  3721. 'foreignKey' => 'category_id',
  3722. 'limit' => '3')
  3723. );
  3724. /**
  3725. * schema method
  3726. *
  3727. * @return void
  3728. */
  3729. public function schema($field = false) {
  3730. if (!isset($this->_schema)) {
  3731. $this->_schema = array(
  3732. 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3733. 'group_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3734. 'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3735. 'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3736. 'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3737. 'description' => array('type' => 'text', 'null' => false, 'default' => '', 'length' => null),
  3738. );
  3739. }
  3740. return $this->_schema;
  3741. }
  3742. }
  3743. /**
  3744. * Article2 class
  3745. *
  3746. * @package Cake.Test.Case.Model
  3747. */
  3748. class Article2 extends CakeTestModel {
  3749. /**
  3750. * name property
  3751. *
  3752. * @var string
  3753. */
  3754. public $name = 'Article2';
  3755. /**
  3756. * table property
  3757. *
  3758. * @var string
  3759. */
  3760. public $table = 'articles';
  3761. /**
  3762. * useTable property
  3763. *
  3764. * @var bool false
  3765. */
  3766. public $useTable = false;
  3767. /**
  3768. * belongsTo property
  3769. *
  3770. * @var array
  3771. */
  3772. public $belongsTo = array(
  3773. 'Category2' => array('className' => 'Category2'),
  3774. 'User2' => array('className' => 'User2')
  3775. );
  3776. /**
  3777. * schema method
  3778. *
  3779. * @return void
  3780. */
  3781. public function schema($field = false) {
  3782. if (!isset($this->_schema)) {
  3783. $this->_schema = array(
  3784. 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3785. 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3786. 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3787. 'rate_count' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3788. 'rate_sum' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3789. 'viewed' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3790. 'version' => array('type' => 'string', 'null' => true, 'default' => '', 'length' => '45'),
  3791. 'title' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '200'),
  3792. 'intro' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
  3793. 'comments' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '4'),
  3794. 'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
  3795. 'isdraft' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  3796. 'allow_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
  3797. 'moderate_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
  3798. 'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  3799. 'multipage' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  3800. 'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
  3801. 'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
  3802. 'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
  3803. );
  3804. }
  3805. return $this->_schema;
  3806. }
  3807. }
  3808. /**
  3809. * CategoryFeatured2 class
  3810. *
  3811. * @package Cake.Test.Case.Model
  3812. */
  3813. class CategoryFeatured2 extends CakeTestModel {
  3814. /**
  3815. * name property
  3816. *
  3817. * @var string
  3818. */
  3819. public $name = 'CategoryFeatured2';
  3820. /**
  3821. * table property
  3822. *
  3823. * @var string
  3824. */
  3825. public $table = 'category_featured';
  3826. /**
  3827. * useTable property
  3828. *
  3829. * @var bool false
  3830. */
  3831. public $useTable = false;
  3832. /**
  3833. * schema method
  3834. *
  3835. * @return void
  3836. */
  3837. public function schema($field = false) {
  3838. if (!isset($this->_schema)) {
  3839. $this->_schema = array(
  3840. 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3841. 'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3842. 'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3843. 'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3844. 'description' => array('text' => 'string', 'null' => false, 'default' => '', 'length' => null)
  3845. );
  3846. }
  3847. return $this->_schema;
  3848. }
  3849. }
  3850. /**
  3851. * Featured2 class
  3852. *
  3853. * @package Cake.Test.Case.Model
  3854. */
  3855. class Featured2 extends CakeTestModel {
  3856. /**
  3857. * name property
  3858. *
  3859. * @var string
  3860. */
  3861. public $name = 'Featured2';
  3862. /**
  3863. * table property
  3864. *
  3865. * @var string
  3866. */
  3867. public $table = 'featured2';
  3868. /**
  3869. * useTable property
  3870. *
  3871. * @var bool false
  3872. */
  3873. public $useTable = false;
  3874. /**
  3875. * belongsTo property
  3876. *
  3877. * @var array
  3878. */
  3879. public $belongsTo = array(
  3880. 'CategoryFeatured2' => array(
  3881. 'className' => 'CategoryFeatured2'
  3882. )
  3883. );
  3884. /**
  3885. * schema method
  3886. *
  3887. * @return void
  3888. */
  3889. public function schema($field = false) {
  3890. if (!isset($this->_schema)) {
  3891. $this->_schema = array(
  3892. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3893. 'article_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3894. 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3895. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
  3896. );
  3897. }
  3898. return $this->_schema;
  3899. }
  3900. }
  3901. /**
  3902. * Comment2 class
  3903. *
  3904. * @package Cake.Test.Case.Model
  3905. */
  3906. class Comment2 extends CakeTestModel {
  3907. /**
  3908. * name property
  3909. *
  3910. * @var string
  3911. */
  3912. public $name = 'Comment2';
  3913. /**
  3914. * table property
  3915. *
  3916. * @var string
  3917. */
  3918. public $table = 'comment';
  3919. /**
  3920. * belongsTo property
  3921. *
  3922. * @var array
  3923. */
  3924. public $belongsTo = array('ArticleFeatured2', 'User2');
  3925. /**
  3926. * useTable property
  3927. *
  3928. * @var bool false
  3929. */
  3930. public $useTable = false;
  3931. /**
  3932. * schema method
  3933. *
  3934. * @return void
  3935. */
  3936. public function schema($field = false) {
  3937. if (!isset($this->_schema)) {
  3938. $this->_schema = array(
  3939. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3940. 'article_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3941. 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3942. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
  3943. );
  3944. }
  3945. return $this->_schema;
  3946. }
  3947. }
  3948. /**
  3949. * ArticleFeatured2 class
  3950. *
  3951. * @package Cake.Test.Case.Model
  3952. */
  3953. class ArticleFeatured2 extends CakeTestModel {
  3954. /**
  3955. * name property
  3956. *
  3957. * @var string
  3958. */
  3959. public $name = 'ArticleFeatured2';
  3960. /**
  3961. * table property
  3962. *
  3963. * @var string
  3964. */
  3965. public $table = 'article_featured';
  3966. /**
  3967. * useTable property
  3968. *
  3969. * @var bool false
  3970. */
  3971. public $useTable = false;
  3972. /**
  3973. * belongsTo property
  3974. *
  3975. * @var array
  3976. */
  3977. public $belongsTo = array(
  3978. 'CategoryFeatured2' => array('className' => 'CategoryFeatured2'),
  3979. 'User2' => array('className' => 'User2')
  3980. );
  3981. /**
  3982. * hasOne property
  3983. *
  3984. * @var array
  3985. */
  3986. public $hasOne = array(
  3987. 'Featured2' => array('className' => 'Featured2')
  3988. );
  3989. /**
  3990. * hasMany property
  3991. *
  3992. * @var array
  3993. */
  3994. public $hasMany = array(
  3995. 'Comment2' => array('className' => 'Comment2', 'dependent' => true)
  3996. );
  3997. /**
  3998. * schema method
  3999. *
  4000. * @return void
  4001. */
  4002. public function schema($field = false) {
  4003. if (!isset($this->_schema)) {
  4004. $this->_schema = array(
  4005. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  4006. 'category_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4007. 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4008. 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  4009. 'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
  4010. 'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  4011. 'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
  4012. 'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
  4013. 'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
  4014. );
  4015. }
  4016. return $this->_schema;
  4017. }
  4018. }
  4019. /**
  4020. * MysqlTestModel class
  4021. *
  4022. * @package Cake.Test.Case.Model
  4023. */
  4024. class MysqlTestModel extends Model {
  4025. /**
  4026. * name property
  4027. *
  4028. * @var string
  4029. */
  4030. public $name = 'MysqlTestModel';
  4031. /**
  4032. * useTable property
  4033. *
  4034. * @var bool false
  4035. */
  4036. public $useTable = false;
  4037. /**
  4038. * find method
  4039. *
  4040. * @param mixed $conditions
  4041. * @param mixed $fields
  4042. * @param mixed $order
  4043. * @param mixed $recursive
  4044. * @return void
  4045. */
  4046. public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
  4047. return $conditions;
  4048. }
  4049. /**
  4050. * findAll method
  4051. *
  4052. * @param mixed $conditions
  4053. * @param mixed $fields
  4054. * @param mixed $order
  4055. * @param mixed $recursive
  4056. * @return void
  4057. */
  4058. public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
  4059. return $conditions;
  4060. }
  4061. /**
  4062. * schema method
  4063. *
  4064. * @return void
  4065. */
  4066. public function schema($field = false) {
  4067. return array(
  4068. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  4069. 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
  4070. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  4071. 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  4072. 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  4073. 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  4074. 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
  4075. 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4076. 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4077. 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4078. 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4079. 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4080. 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  4081. 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4082. 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
  4083. 'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
  4084. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  4085. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  4086. );
  4087. }
  4088. }
  4089. /**
  4090. * Test model for datasource prefixes
  4091. *
  4092. */
  4093. class PrefixTestModel extends CakeTestModel {
  4094. }
  4095. class PrefixTestUseTableModel extends CakeTestModel {
  4096. public $name = 'PrefixTest';
  4097. public $useTable = 'prefix_tests';
  4098. }
  4099. /**
  4100. * ScaffoldMock class
  4101. *
  4102. * @package Cake.Test.Case.Controller
  4103. */
  4104. class ScaffoldMock extends CakeTestModel {
  4105. /**
  4106. * useTable property
  4107. *
  4108. * @var string
  4109. */
  4110. public $useTable = 'articles';
  4111. /**
  4112. * belongsTo property
  4113. *
  4114. * @var array
  4115. */
  4116. public $belongsTo = array(
  4117. 'User' => array(
  4118. 'className' => 'ScaffoldUser',
  4119. 'foreignKey' => 'user_id',
  4120. )
  4121. );
  4122. /**
  4123. * hasMany property
  4124. *
  4125. * @var array
  4126. */
  4127. public $hasMany = array(
  4128. 'Comment' => array(
  4129. 'className' => 'ScaffoldComment',
  4130. 'foreignKey' => 'article_id',
  4131. )
  4132. );
  4133. /**
  4134. * hasAndBelongsToMany property
  4135. *
  4136. * @var string
  4137. */
  4138. public $hasAndBelongsToMany = array(
  4139. 'ScaffoldTag' => array(
  4140. 'className' => 'ScaffoldTag',
  4141. 'foreignKey' => 'something_id',
  4142. 'associationForeignKey' => 'something_else_id',
  4143. 'joinTable' => 'join_things'
  4144. )
  4145. );
  4146. }
  4147. /**
  4148. * ScaffoldUser class
  4149. *
  4150. * @package Cake.Test.Case.Controller
  4151. */
  4152. class ScaffoldUser extends CakeTestModel {
  4153. /**
  4154. * useTable property
  4155. *
  4156. * @var string
  4157. */
  4158. public $useTable = 'users';
  4159. /**
  4160. * hasMany property
  4161. *
  4162. * @var array
  4163. */
  4164. public $hasMany = array(
  4165. 'Article' => array(
  4166. 'className' => 'ScaffoldMock',
  4167. 'foreignKey' => 'article_id',
  4168. )
  4169. );
  4170. }
  4171. /**
  4172. * ScaffoldComment class
  4173. *
  4174. * @package Cake.Test.Case.Controller
  4175. */
  4176. class ScaffoldComment extends CakeTestModel {
  4177. /**
  4178. * useTable property
  4179. *
  4180. * @var string
  4181. */
  4182. public $useTable = 'comments';
  4183. /**
  4184. * belongsTo property
  4185. *
  4186. * @var array
  4187. */
  4188. public $belongsTo = array(
  4189. 'Article' => array(
  4190. 'className' => 'ScaffoldMock',
  4191. 'foreignKey' => 'article_id',
  4192. )
  4193. );
  4194. }
  4195. /**
  4196. * ScaffoldTag class
  4197. *
  4198. * @package Cake.Test.Case.Controller
  4199. */
  4200. class ScaffoldTag extends CakeTestModel {
  4201. /**
  4202. * useTable property
  4203. *
  4204. * @var string
  4205. */
  4206. public $useTable = 'tags';
  4207. }
  4208. /**
  4209. * Player class
  4210. *
  4211. * @package Cake.Test.Case.Model
  4212. */
  4213. class Player extends CakeTestModel {
  4214. public $hasAndBelongsToMany = array(
  4215. 'Guild' => array(
  4216. 'with' => 'GuildsPlayer',
  4217. 'unique' => true,
  4218. ),
  4219. );
  4220. }
  4221. /**
  4222. * Guild class
  4223. *
  4224. * @package Cake.Test.Case.Model
  4225. */
  4226. class Guild extends CakeTestModel {
  4227. public $hasAndBelongsToMany = array(
  4228. 'Player' => array(
  4229. 'with' => 'GuildsPlayer',
  4230. 'unique' => true,
  4231. ),
  4232. );
  4233. }
  4234. /**
  4235. * GuildsPlayer class
  4236. *
  4237. * @package Cake.Test.Case.Model
  4238. */
  4239. class GuildsPlayer extends CakeTestModel {
  4240. public $useDbConfig = 'test2';
  4241. public $belongsTo = array(
  4242. 'Player',
  4243. 'Guild',
  4244. );
  4245. }
  4246. /**
  4247. * Armor class
  4248. *
  4249. * @package Cake.Test.Case.Model
  4250. */
  4251. class Armor extends CakeTestModel {
  4252. public $useDbConfig = 'test2';
  4253. public $hasAndBelongsToMany = array(
  4254. 'Player' => array('with' => 'ArmorsPlayer'),
  4255. );
  4256. }
  4257. /**
  4258. * ArmorsPlayer class
  4259. *
  4260. * @package Cake.Test.Case.Model
  4261. */
  4262. class ArmorsPlayer extends CakeTestModel {
  4263. public $useDbConfig = 'test_database_three';
  4264. }
  4265. /**
  4266. * CustomArticle class
  4267. *
  4268. * @package Cake.Test.Case.Model
  4269. */
  4270. class CustomArticle extends AppModel {
  4271. /**
  4272. * useTable property
  4273. *
  4274. * @var string
  4275. */
  4276. public $useTable = 'articles';
  4277. /**
  4278. * findMethods property
  4279. *
  4280. * @var array
  4281. */
  4282. public $findMethods = array('unPublished' => true);
  4283. /**
  4284. * belongsTo property
  4285. *
  4286. * @var array
  4287. */
  4288. public $belongsTo = array('User');
  4289. /**
  4290. * _findUnPublished custom find
  4291. *
  4292. * @return array
  4293. */
  4294. protected function _findUnPublished($state, $query, $results = array()) {
  4295. if ($state === 'before') {
  4296. $query['conditions']['published'] = 'N';
  4297. return $query;
  4298. }
  4299. return $results;
  4300. }
  4301. /**
  4302. * Alters title data
  4303. *
  4304. * @return void
  4305. */
  4306. public function beforeValidate($options = array()) {
  4307. $this->data[$this->alias]['title'] = 'foo';
  4308. if ($this->findMethods['unPublished'] === true) {
  4309. $this->findMethods['unPublished'] = false;
  4310. } else {
  4311. $this->findMethods['unPublished'] = 'true again';
  4312. }
  4313. }
  4314. }