1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00
joplin/tests/setup.php

28 lines
682 B
PHP
Raw Normal View History

2016-10-19 17:54:41 +02:00
<?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',
2016-10-26 17:03:26 +02:00
'database' => $dbName,
2016-10-19 17:54:41 +02:00
'username' => 'root',
'password' => 'pass',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
]);
$capsule->bootEloquent();