MenuLinkTreeFixture.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <?php
  2. /**
  3. * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
  12. * @since 3.0.0
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\Fixture;
  16. use Cake\TestSuite\Fixture\TestFixture;
  17. /**
  18. * Class NumberTreeFixture
  19. *
  20. * Generates a tree of data for use testing the tree behavior
  21. *
  22. */
  23. class MenuLinkTreeFixture extends TestFixture {
  24. /**
  25. * fields property
  26. *
  27. * @var array
  28. */
  29. public $fields = array(
  30. 'id' => ['type' => 'integer'],
  31. 'menu' => ['type' => 'string', 'null' => false],
  32. 'lft' => ['type' => 'integer'],
  33. 'rght' => ['type' => 'integer'],
  34. 'parent_id' => 'integer',
  35. 'url' => ['type' => 'string', 'null' => false],
  36. 'title' => ['type' => 'string', 'null' => false],
  37. '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
  38. );
  39. /**
  40. * Records
  41. *
  42. * # main-menu:
  43. *
  44. * - Link 1:1
  45. * - Link 2:2
  46. * - Link 3:3
  47. * - Link 4:4
  48. * - Link 5:5
  49. * - Link 6:6
  50. * - Link 7:7
  51. * - Link 8:8
  52. *
  53. * ***
  54. *
  55. * # categories:
  56. *
  57. * - electronics:9
  58. * - televisions:10
  59. * - tube:11
  60. * - lcd:12
  61. * - plasma:13
  62. * - portable:14
  63. * - mp3:15
  64. * - flash:16
  65. * - cd:17
  66. * - radios:18
  67. *
  68. * **Note:** title:id
  69. */
  70. public $records = array(
  71. array(
  72. 'menu' => 'main-menu',
  73. 'lft' => '1',
  74. 'rght' => '10',
  75. 'parent_id' => null,
  76. 'url' => '/link1.html',
  77. 'title' => 'Link 1',
  78. ),
  79. array(
  80. 'menu' => 'main-menu',
  81. 'lft' => '2',
  82. 'rght' => '3',
  83. 'parent_id' => '1',
  84. 'url' => 'http://example.com',
  85. 'title' => 'Link 2',
  86. ),
  87. array(
  88. 'menu' => 'main-menu',
  89. 'lft' => '4',
  90. 'rght' => '9',
  91. 'parent_id' => '1',
  92. 'url' => '/what/even-more-links.html',
  93. 'title' => 'Link 3',
  94. ),
  95. array(
  96. 'menu' => 'main-menu',
  97. 'lft' => '5',
  98. 'rght' => '8',
  99. 'parent_id' => '3',
  100. 'url' => '/lorem/ipsum.html',
  101. 'title' => 'Link 4',
  102. ),
  103. array(
  104. 'menu' => 'main-menu',
  105. 'lft' => '6',
  106. 'rght' => '7',
  107. 'parent_id' => '4',
  108. 'url' => '/what/the.html',
  109. 'title' => 'Link 5',
  110. ),
  111. array(
  112. 'menu' => 'main-menu',
  113. 'lft' => '11',
  114. 'rght' => '14',
  115. 'parent_id' => null,
  116. 'url' => '/yeah/another-link.html',
  117. 'title' => 'Link 6',
  118. ),
  119. array(
  120. 'menu' => 'main-menu',
  121. 'lft' => '12',
  122. 'rght' => '13',
  123. 'parent_id' => '6',
  124. 'url' => 'http://cakephp.org',
  125. 'title' => 'Link 7',
  126. ),
  127. array(
  128. 'menu' => 'main-menu',
  129. 'lft' => '15',
  130. 'rght' => '16',
  131. 'parent_id' => null,
  132. 'url' => '/page/who-we-are.html',
  133. 'title' => 'Link 8',
  134. ),
  135. array(
  136. 'menu' => 'categories',
  137. 'lft' => '1',
  138. 'rght' => '10',
  139. 'parent_id' => null,
  140. 'url' => '/cagetory/electronics.html',
  141. 'title' => 'electronics',
  142. ),
  143. array(
  144. 'menu' => 'categories',
  145. 'lft' => '2',
  146. 'rght' => '9',
  147. 'parent_id' => '9',
  148. 'url' => '/category/televisions.html',
  149. 'title' => 'televisions',
  150. ),
  151. array(
  152. 'menu' => 'categories',
  153. 'lft' => '3',
  154. 'rght' => '4',
  155. 'parent_id' => '10',
  156. 'url' => '/category/tube.html',
  157. 'title' => 'tube',
  158. ),
  159. array(
  160. 'menu' => 'categories',
  161. 'lft' => '5',
  162. 'rght' => '8',
  163. 'parent_id' => '10',
  164. 'url' => '/category/lcd.html',
  165. 'title' => 'lcd',
  166. ),
  167. array(
  168. 'menu' => 'categories',
  169. 'lft' => '6',
  170. 'rght' => '7',
  171. 'parent_id' => '12',
  172. 'url' => '/category/plasma.html',
  173. 'title' => 'plasma',
  174. ),
  175. array(
  176. 'menu' => 'categories',
  177. 'lft' => '11',
  178. 'rght' => '20',
  179. 'parent_id' => null,
  180. 'url' => '/category/portable.html',
  181. 'title' => 'portable',
  182. ),
  183. array(
  184. 'menu' => 'categories',
  185. 'lft' => '12',
  186. 'rght' => '15',
  187. 'parent_id' => '14',
  188. 'url' => '/category/mp3.html',
  189. 'title' => 'mp3',
  190. ),
  191. array(
  192. 'menu' => 'categories',
  193. 'lft' => '13',
  194. 'rght' => '14',
  195. 'parent_id' => '15',
  196. 'url' => '/category/flash.html',
  197. 'title' => 'flash',
  198. ),
  199. array(
  200. 'menu' => 'categories',
  201. 'lft' => '16',
  202. 'rght' => '17',
  203. 'parent_id' => '14',
  204. 'url' => '/category/cd.html',
  205. 'title' => 'cd',
  206. ),
  207. array(
  208. 'menu' => 'categories',
  209. 'lft' => '18',
  210. 'rght' => '19',
  211. 'parent_id' => '14',
  212. 'url' => '/category/radios.html',
  213. 'title' => 'radios',
  214. ),
  215. );
  216. }