1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00
joplin/tests/setup.php
2016-10-19 16:54:41 +01:00

28 lines
687 B
PHP

<?php
require_once dirname(__FILE__) . '/BaseTestCase.php';
$dbName = 'notes_test';
$structureFile = dirname(dirname(__FILE__)) . '/structure.sql';
$cmd = sprintf("mysql -u root -ppass -e 'DROP DATABASE IF EXISTS %s; CREATE DATABASE %s;'", $dbName, $dbName);
exec($cmd);
$cmd = sprintf("mysql -u root -ppass %s < '%s'", $dbName, $structureFile);
exec($cmd);
$capsule = new \Illuminate\Database\Capsule\Manager();
$capsule->addConnection([
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'notes_test',
'username' => 'root',
'password' => 'pass',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
]);
$capsule->bootEloquent();