docs and tests configuration for mysql support
This commit is contained in:
parent
0a3292ae58
commit
8cd29d3600
@ -26,10 +26,14 @@ script:
|
|||||||
- ./node_modules/.bin/jshint assets/js/src/*.js
|
- ./node_modules/.bin/jshint assets/js/src/*.js
|
||||||
- ./vendor/bin/phpunit -c tests/phpunit.unit.sqlite.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.unit.sqlite.xml
|
||||||
- ./vendor/bin/phpunit -c tests/phpunit.unit.postgres.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.unit.postgres.xml
|
||||||
|
- ./vendor/bin/phpunit -c tests/phpunit.unit.mysql.xml
|
||||||
- ./vendor/bin/phpunit -c tests/phpunit.functional.sqlite.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.functional.sqlite.xml
|
||||||
- cp ./tests/ci/config.postgres.php $TRAVIS_BUILD_DIR/config.php
|
- cp ./tests/ci/config.postgres.php $TRAVIS_BUILD_DIR/config.php
|
||||||
- ./vendor/bin/phpunit -c tests/phpunit.functional.postgres.xml tests/functional/ApiTest.php
|
- ./vendor/bin/phpunit -c tests/phpunit.functional.postgres.xml tests/functional/ApiTest.php
|
||||||
- ./vendor/bin/phpunit -c tests/phpunit.functional.postgres.xml tests/functional/FeverApiTest.php
|
- ./vendor/bin/phpunit -c tests/phpunit.functional.postgres.xml tests/functional/FeverApiTest.php
|
||||||
|
- cp ./tests/ci/config.mysql.php $TRAVIS_BUILD_DIR/config.php
|
||||||
|
- ./vendor/bin/phpunit -c tests/phpunit.functional.mysql.xml tests/functional/ApiTest.php
|
||||||
|
- ./vendor/bin/phpunit -c tests/phpunit.functional.mysql.xml tests/functional/FeverApiTest.php
|
||||||
|
|
||||||
after_failure:
|
after_failure:
|
||||||
- cat apache_error.log
|
- cat apache_error.log
|
||||||
|
@ -12,7 +12,7 @@ To override them, rename the file `config.default.php` to `config.php`.
|
|||||||
Database configuration
|
Database configuration
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
By default, Miniflux uses Sqlite but Postgres and mysql are also supported.
|
By default, Miniflux uses Sqlite but Postgres and MySQL are also supported.
|
||||||
|
|
||||||
### Sqlite configuration
|
### Sqlite configuration
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ define('FAVICON_URL_PATH', 'data/favicons');
|
|||||||
// Database driver: "sqlite", "postgres", or "mysql" default is sqlite
|
// Database driver: "sqlite", "postgres", or "mysql" default is sqlite
|
||||||
define('DB_DRIVER', 'sqlite');
|
define('DB_DRIVER', 'sqlite');
|
||||||
|
|
||||||
// Database connection parameters when Postgres or Mysql are used
|
// Database connection parameters when Postgres or MySQL are used
|
||||||
define('DB_HOSTNAME', 'localhost');
|
define('DB_HOSTNAME', 'localhost');
|
||||||
define('DB_NAME', 'miniflux');
|
define('DB_NAME', 'miniflux');
|
||||||
define('DB_USERNAME', 'postgres');
|
define('DB_USERNAME', 'my db user');
|
||||||
define('DB_PASSWORD', '');
|
define('DB_PASSWORD', 'my secret password');
|
||||||
|
|
||||||
// DB_FILENAME => database file when Sqlite is used
|
// DB_FILENAME => database file when Sqlite is used
|
||||||
define('DB_FILENAME', DATA_DIRECTORY.'/db.sqlite');
|
define('DB_FILENAME', DATA_DIRECTORY.'/db.sqlite');
|
||||||
|
@ -27,7 +27,7 @@ Installation
|
|||||||
1. `git clone https://github.com/miniflux/miniflux.git`
|
1. `git clone https://github.com/miniflux/miniflux.git`
|
||||||
2. Go to the third step just above
|
2. Go to the third step just above
|
||||||
|
|
||||||
By default, Miniflux uses Sqlite, if you would like to use Postgres instead you will have to modify your `config.php` file.
|
By default, Miniflux uses Sqlite, if you would like to use Postgres or MySQL instead you will have to modify your `config.php` file.
|
||||||
|
|
||||||
Security
|
Security
|
||||||
--------
|
--------
|
||||||
|
7
tests/ci/config.mysql.php
Normal file
7
tests/ci/config.mysql.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
defined('DB_DRIVER') or define('DB_DRIVER', 'mysql');
|
||||||
|
defined('DB_HOSTNAME') or define('DB_HOSTNAME', 'localhost');
|
||||||
|
defined('DB_NAME') or define('DB_NAME', 'miniflux_functional_test');
|
||||||
|
defined('DB_USERNAME') or define('DB_USERNAME', 'root');
|
||||||
|
defined('DB_PASSWORD') or define('DB_PASSWORD', '');
|
@ -16,6 +16,15 @@ abstract class BaseApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$pdo->exec('DROP DATABASE '.DB_NAME);
|
$pdo->exec('DROP DATABASE '.DB_NAME);
|
||||||
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
||||||
$pdo = null;
|
$pdo = null;
|
||||||
|
} else if (DB_DRIVER === 'mysql') {
|
||||||
|
$pdo = new PDO('mysql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
|
||||||
|
$stmt = $pdo->query("SELECT information_schema.processlist.id FROM information_schema.processlist WHERE information_schema.processlist.DB = '".DB_NAME."' AND id <> connection_id()");
|
||||||
|
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$pdo->exec('KILL '.$row['id']);
|
||||||
|
}
|
||||||
|
$pdo->exec('DROP DATABASE '.DB_NAME);
|
||||||
|
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
||||||
|
$pdo = null;
|
||||||
} else if (file_exists(DB_FILENAME)) {
|
} else if (file_exists(DB_FILENAME)) {
|
||||||
unlink(DB_FILENAME);
|
unlink(DB_FILENAME);
|
||||||
}
|
}
|
||||||
|
15
tests/phpunit.functional.mysql.xml
Normal file
15
tests/phpunit.functional.mysql.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<phpunit stopOnError="true" stopOnFailure="true" colors="true">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Miniflux MySQL Functional Tests">
|
||||||
|
<directory>functional</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<php>
|
||||||
|
<const name="API_URL" value="http://127.0.0.1/jsonrpc.php" />
|
||||||
|
<const name="FEVER_API_URL" value="http://127.0.0.1/fever/" />
|
||||||
|
<const name="DB_DRIVER" value="mysql" />
|
||||||
|
<const name="DB_USERNAME" value="root" />
|
||||||
|
<const name="DB_PASSWORD" value="" />
|
||||||
|
<const name="DB_NAME" value="miniflux_functional_test" />
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
13
tests/phpunit.unit.mysql.xml
Normal file
13
tests/phpunit.unit.mysql.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<phpunit stopOnError="true" stopOnFailure="true" colors="true">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Miniflux MySQL Unit Tests">
|
||||||
|
<directory>unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<php>
|
||||||
|
<const name="DB_DRIVER" value="mysql" />
|
||||||
|
<const name="DB_USERNAME" value="root" />
|
||||||
|
<const name="DB_PASSWORD" value="" />
|
||||||
|
<const name="DB_NAME" value="miniflux_unit_test" />
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
@ -17,6 +17,11 @@ abstract class BaseTest extends PHPUnit_Framework_TestCase
|
|||||||
$pdo->exec('DROP DATABASE '.DB_NAME);
|
$pdo->exec('DROP DATABASE '.DB_NAME);
|
||||||
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
||||||
$pdo = null;
|
$pdo = null;
|
||||||
|
} else if (DB_DRIVER === 'mysql') {
|
||||||
|
$pdo = new PDO('mysql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
|
||||||
|
$pdo->exec('DROP DATABASE '.DB_NAME);
|
||||||
|
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
||||||
|
$pdo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
PicoDb\Database::setInstance('db', function () {
|
PicoDb\Database::setInstance('db', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user