PersonFixture.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 PersonFixture
  19. *
  20. */
  21. class PersonFixture extends TestFixture {
  22. /**
  23. * fields property
  24. *
  25. * @var array
  26. */
  27. public $fields = array(
  28. 'id' => ['type' => 'integer', 'null' => false],
  29. 'name' => ['type' => 'string', 'null' => false, 'length' => 32],
  30. 'mother_id' => ['type' => 'integer', 'null' => true],
  31. 'father_id' => ['type' => 'integer', 'null' => true],
  32. '_constraints' => [
  33. 'primary' => ['type' => 'primary', 'columns' => ['id']],
  34. 'mother_idx' => ['type' => 'unique', 'columns' => ['mother_id', 'father_id']],
  35. ]
  36. );
  37. /**
  38. * records property
  39. *
  40. * @var array
  41. */
  42. public $records = array(
  43. array('name' => 'person', 'mother_id' => 2, 'father_id' => 3),
  44. array('name' => 'mother', 'mother_id' => 4, 'father_id' => 5),
  45. array('name' => 'father', 'mother_id' => 6, 'father_id' => 7),
  46. array('name' => 'mother - grand mother', 'mother_id' => null, 'father_id' => null),
  47. array('name' => 'mother - grand father', 'mother_id' => null, 'father_id' => null),
  48. array('name' => 'father - grand mother', 'mother_id' => null, 'father_id' => null),
  49. array('name' => 'father - grand father', 'mother_id' => null, 'father_id' => null)
  50. );
  51. }