NumberTreesFixture.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 1.2.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\Fixture;
  16. use Cake\TestSuite\Fixture\TestFixture;
  17. /**
  18. * NumberTreeFixture
  19. *
  20. * Generates a tree of data for use testing the tree behavior
  21. */
  22. class NumberTreesFixture extends TestFixture
  23. {
  24. /**
  25. * Records
  26. *
  27. * - electronics:1
  28. * - televisions:2
  29. * - tube:3
  30. * - lcd:4
  31. * - plasma:5
  32. * - portable:6
  33. * - mp3:7
  34. * - flash:8
  35. * - cd:9
  36. * - radios:10
  37. * - alien ware: 11
  38. *
  39. * @var array
  40. */
  41. public array $records = [
  42. [
  43. 'name' => 'electronics',
  44. 'parent_id' => null,
  45. 'lft' => '1',
  46. 'rght' => '20',
  47. 'depth' => 0,
  48. ],
  49. [
  50. 'name' => 'televisions',
  51. 'parent_id' => '1',
  52. 'lft' => '2',
  53. 'rght' => '9',
  54. 'depth' => 1,
  55. ],
  56. [
  57. 'name' => 'tube',
  58. 'parent_id' => '2',
  59. 'lft' => '3',
  60. 'rght' => '4',
  61. 'depth' => 2,
  62. ],
  63. [
  64. 'name' => 'lcd',
  65. 'parent_id' => '2',
  66. 'lft' => '5',
  67. 'rght' => '6',
  68. 'depth' => 2,
  69. ],
  70. [
  71. 'name' => 'plasma',
  72. 'parent_id' => '2',
  73. 'lft' => '7',
  74. 'rght' => '8',
  75. 'depth' => 2,
  76. ],
  77. [
  78. 'name' => 'portable',
  79. 'parent_id' => '1',
  80. 'lft' => '10',
  81. 'rght' => '19',
  82. 'depth' => 1,
  83. ],
  84. [
  85. 'name' => 'mp3',
  86. 'parent_id' => '6',
  87. 'lft' => '11',
  88. 'rght' => '14',
  89. 'depth' => 2,
  90. ],
  91. [
  92. 'name' => 'flash',
  93. 'parent_id' => '7',
  94. 'lft' => '12',
  95. 'rght' => '13',
  96. 'depth' => 3,
  97. ],
  98. [
  99. 'name' => 'cd',
  100. 'parent_id' => '6',
  101. 'lft' => '15',
  102. 'rght' => '16',
  103. 'depth' => 2,
  104. ],
  105. [
  106. 'name' => 'radios',
  107. 'parent_id' => '6',
  108. 'lft' => '17',
  109. 'rght' => '18',
  110. 'depth' => 2,
  111. ],
  112. [
  113. 'name' => 'alien hardware',
  114. 'parent_id' => null,
  115. 'lft' => '21',
  116. 'rght' => '22',
  117. 'depth' => 0,
  118. ],
  119. ];
  120. }