PHP code example of mrkrstphr / dbunit-fixture-arrays

1. Go to this page and download the library: Download mrkrstphr/dbunit-fixture-arrays library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mrkrstphr / dbunit-fixture-arrays example snippets


public function getDataSet() {
    return new ArrayDataSet([
        '/path_to_file.php',
        '/path_to_other_file.php'
    ]);
}

return [
    'table_name' => [
        ['id' => 1, 'name' => 'Row Data 1'],
        ['id' => 2, 'name' => 'Row Data 2'],
    ],
    'other_table_name' => [
        ['id' => 99, 'color' => 'Red'],
        ['id' => 88, 'color' => 'Blue'],
    ],
];

return [
    'table_name' => [
        ['id' => 1, 'date' => (new DateTime('+1 year'))->format('Y-m-d')],
        ['id' => 2, 'date' => '2014-05-01'
    ]
];