StatsFixture.php 2.71 KB
<?php
namespace App\Test\Fixture;

use Cake\TestSuite\Fixture\TestFixture;

/**
 * StatsFixture
 */
class StatsFixture extends TestFixture
{
    
    // (EP) pour éviter d'avoir à décrire les champs
    public $import = ['model' => 'Stats'];
    
    /**
     * Fields
     *
     * @var array
     */
    
    /* (EP)
    // @codingStandardsIgnoreStart
    public $fields = [
        'year' => ['type' => 'string', 'length' => null, 'null' => false, 'default' => null, 'collate' => null, 'comment' => '', 'precision' => null, 'fixed' => null],
        'user_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
        'last_login_time' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null],
        'last_logout_time' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null],
        'connex_nb' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => '0', 'comment' => 'nb connexions sur l\'année', 'precision' => null, 'autoIncrement' => null],
        'connex_dur' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => '0', 'comment' => 'total temps connexion sur l\'année (sec)', 'precision' => null, 'autoIncrement' => null],
        '_indexes' => [
            'fk_stats_users' => ['type' => 'index', 'columns' => ['user_id'], 'length' => []],
            'index_stats_year' => ['type' => 'index', 'columns' => ['year'], 'length' => []],
        ],
        '_constraints' => [
            'primary' => ['type' => 'primary', 'columns' => ['year', 'user_id'], 'length' => []],
            'fk_stats_users' => ['type' => 'foreign', 'columns' => ['user_id'], 'references' => ['users', 'id'], 'update' => 'restrict', 'delete' => 'cascade', 'length' => []],
        ],
        '_options' => [
            'engine' => 'InnoDB',
            'collation' => 'latin1_swedish_ci'
        ],
    ];
    */
    
    // @codingStandardsIgnoreEnd
    /**
     * Init method
     *
     * @return void
     */
    public function init()
    {
        // (EP)
        $this->records = null;
        //$this->records = [];
        /*
        $this->records = [
            [
                //'year' => 'a4a821dd-3174-4fa5-9672-b2d5b3d9903c',
                'year' => 2020,
                'user_id' => 1,
                //'last_login_time' => '2020-10-21 17:11:18',
                //'last_logout_time' => '2020-10-21 17:11:18',
                //'connex_nb' => 1,
                //'connex_dur' => 1
            ],
        ];
        */
        parent::init();
    }
}