cnizzardini/cakephp-sakila-plugin

A data seeder based on the MySQL Sakila database for CakePHP 4.x

v2.0.0 2024-01-08 21:48 UTC

This package is auto-updated.

Last update: 2024-04-08 22:28:00 UTC


README

Latest Version on Packagist License: MIT Build Status Coverage Status CakePHP Minimum PHP Version

This Cake 4 plugin comes with a snapshot and data seeds for the MySQL Sakila Sample Data. I found myself needing test data when I am creating new plugins and wanted something with complex enough relations for realistic development. While the SQL dump provided by MySQL is okay, it doesn't follow full Cake conventions. This plugin includes full cake conventions and additional schema improvements.

Install

composer require cnizzardini/cakephp-sakila-plugin
bin/cake plugin load Sakila

Alternatively after composer installing you can manually load the plugin in your Application:

# src/Application.php
public function bootstrap(): void
{
    // other logic...
    $this->addPlugin('Sakila');
}

Usage

Run migrate and seed with -p Sakila

bin/cake migrations migrate -p Sakila
bin/cake migrations seed -p Sakila

Baking

You should now be able to bake a full application skeleton

bin/cake bake all --everything

Verify everything is working by running bin/cake server

Schema

See config/Migrations/20200422015732_Initial.php for full schema.

Unit Tests

Unit tests ensure the schema can be built and seeders run. It uses cakephp/migrations and SQLite for the data store.

vendor/bin/phpunit