ProductsFixture.php 1.5 KB

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