CakePHP Plugin that extends the capability of a Fixture to load not only structure but already.
composer require aircargobook/cakephp-fixture-importer
Load the Trait into your existing fixture.
<?php
namespace App\Test\Fixture;
use Aircargobook\CakephpFixtureImporter\Traits\FixtureImportTrait;
use Cake\TestSuite\Fixture\TestFixture;
class ExampleFixture extends TestFixture
{
/** @var array Set this property to load fixtures to a different test datasource */
public $import = ['table' => 'example', 'connection' => 'test_fixtures'];
/**
* @return void
*/
public function init()
{
parent::init();
$this->insertDataFromSourceTable();
}
}
It will now load the table structure from the test_fixture connection and insert data from the test_fixture connection into the connection test.