'TestApp', 'encoding' => 'UTF-8', 'paths' => [ 'webroot' => PLUGIN_ROOT . DS . 'webroot' . DS, 'templates' => [ PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'templates' . DS, ], ], ]); Configure::write('debug', true); Configure::write('CakeProducts', [ 'photos' => [ 'directory' => PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'images' . DS . 'products' . DS, ], /** * internal CakeProducts settings - used in the source of truth/internal only system. * Can optionally manage external catalogs * * - syncExternally - defaults to false - product catalogs can have 1 or more external catalogs linked to them * which will receive changes to the catalogs and optionally allow for external API access. * Will have no effect if true but no external catalogs have been added or none are enabled */ 'internal' => [ 'enabled' => true, /** * syncExternally defaults to false - product catalogs can have 1 or more external catalogs linked to them * which will receive changes to the catalogs and optionally allow for external API access. * Will have no effect if true but no external catalogs have been added or none are enabled */ 'syncExternally' => false, ], 'external' => [ // product catalog settings for external use (as an API server to power an ecommerce site for example) 'enabled' => false, ], ]); $cache = [ 'default' => [ 'engine' => 'File', 'path' => CACHE, ], '_cake_translations_' => [ 'className' => 'File', 'prefix' => 'crud_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds', ], '_cake_model_' => [ 'className' => 'File', 'prefix' => 'crud_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds', ], ]; Cache::setConfig($cache); class_alias(AppController::class, 'App\Controller\AppController'); Plugin::getCollection()->add(new CakeProductsPlugin()); Chronos::setTestNow(Chronos::now()); if (!getenv('DB_URL')) { putenv('DB_URL=sqlite:///:memory:'); } ConnectionManager::setConfig('test', [ 'className' => Connection::class, 'url' => getenv('DB_URL') ?: null, 'timezone' => 'UTC', 'quoteIdentifiers' => false, 'cacheMetadata' => true, ]); /** * Load schema from a SQL dump file. * * If your plugin does not use database fixtures you can * safely delete this. * * If you want to support multiple databases, consider * using migrations to provide schema for your plugin, * and using \Migrations\TestSuite\Migrator to load schema. */ // Load a schema dump file. //(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test'); $migrator = new Migrator(); $migrator->run(['plugin' => 'CakeProducts']);