NumberTreeFixture.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 1.2.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 NumberTreeFixture extends TestFixture {
  24. /**
  25. * fields property
  26. *
  27. * @var array
  28. */
  29. public $fields = array(
  30. 'id' => ['type' => 'integer'],
  31. 'name' => ['type' => 'string', 'null' => false],
  32. 'parent_id' => 'integer',
  33. 'lft' => ['type' => 'integer'],
  34. 'rght' => ['type' => 'integer'],
  35. '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
  36. );
  37. /**
  38. * Records
  39. *
  40. * - electronics:1
  41. * - televisions:2
  42. * - tube:3
  43. * - lcd:4
  44. * - plasma:5
  45. * - portable:6
  46. * - mp3:7
  47. * - flash:8
  48. * - cd:9
  49. * - radios:10
  50. * - alien ware: 11
  51. *
  52. * @var array
  53. */
  54. public $records = array(
  55. array(
  56. 'name' => 'electronics',
  57. 'parent_id' => null,
  58. 'lft' => '1',
  59. 'rght' => '20'
  60. ),
  61. array(
  62. 'name' => 'televisions',
  63. 'parent_id' => '1',
  64. 'lft' => '2',
  65. 'rght' => '9'
  66. ),
  67. array(
  68. 'name' => 'tube',
  69. 'parent_id' => '2',
  70. 'lft' => '3',
  71. 'rght' => '4'
  72. ),
  73. array(
  74. 'name' => 'lcd',
  75. 'parent_id' => '2',
  76. 'lft' => '5',
  77. 'rght' => '6'
  78. ),
  79. array(
  80. 'name' => 'plasma',
  81. 'parent_id' => '2',
  82. 'lft' => '7',
  83. 'rght' => '8'
  84. ),
  85. array(
  86. 'name' => 'portable',
  87. 'parent_id' => '1',
  88. 'lft' => '10',
  89. 'rght' => '19'
  90. ),
  91. array(
  92. 'name' => 'mp3',
  93. 'parent_id' => '6',
  94. 'lft' => '11',
  95. 'rght' => '14'
  96. ),
  97. array(
  98. 'name' => 'flash',
  99. 'parent_id' => '7',
  100. 'lft' => '12',
  101. 'rght' => '13'
  102. ),
  103. array(
  104. 'name' => 'cd',
  105. 'parent_id' => '6',
  106. 'lft' => '15',
  107. 'rght' => '16'
  108. ),
  109. array(
  110. 'name' => 'radios',
  111. 'parent_id' => '6',
  112. 'lft' => '17',
  113. 'rght' => '18'
  114. ),
  115. array(
  116. 'name' => 'alien hardware',
  117. 'parent_id' => null,
  118. 'lft' => '21',
  119. 'rght' => '22'
  120. )
  121. );
  122. }