ProductsFixture.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 3.0.7
  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. * ProductsFixture
  19. */
  20. class ProductsFixture extends TestFixture
  21. {
  22. /**
  23. * {@inheritDoc}
  24. */
  25. public $table = 'products';
  26. /**
  27. * fields property
  28. *
  29. * @var array
  30. */
  31. public $fields = [
  32. 'id' => ['type' => 'integer'],
  33. 'category' => ['type' => 'integer', 'null' => false],
  34. 'name' => ['type' => 'string', 'null' => false],
  35. 'price' => ['type' => 'integer'],
  36. '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['category', 'id']]],
  37. ];
  38. /**
  39. * records property
  40. *
  41. * @var array
  42. */
  43. public $records = [
  44. ['id' => 1, 'category' => 1, 'name' => 'First product', 'price' => 10],
  45. ['id' => 2, 'category' => 2, 'name' => 'Second product', 'price' => 20],
  46. ['id' => 3, 'category' => 3, 'name' => 'Third product', 'price' => 30],
  47. ];
  48. }