mirror of
https://github.com/flarum/core.git
synced 2025-07-19 07:41:22 +02:00
Setup Composer commands for testing and setup
This commit is contained in:
@@ -86,5 +86,14 @@
|
|||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "0.1.x-dev"
|
"dev-master": "0.1.x-dev"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": [
|
||||||
|
"@test:unit",
|
||||||
|
"@test:integration"
|
||||||
|
],
|
||||||
|
"test:unit": "phpunit -c tests/phpunit.unit.xml",
|
||||||
|
"test:integration": "phpunit -c tests/phpunit.integration.xml",
|
||||||
|
"test:setup": "@php tests/integration/setup.php"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
53
framework/core/tests/integration/setup.php
Normal file
53
framework/core/tests/integration/setup.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Flarum.
|
||||||
|
*
|
||||||
|
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Flarum\Install\AdminUser;
|
||||||
|
use Flarum\Install\DatabaseConfig;
|
||||||
|
use Flarum\Install\Installation;
|
||||||
|
|
||||||
|
require __DIR__.'/../../vendor/autoload.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup installation configuration
|
||||||
|
*/
|
||||||
|
|
||||||
|
$installation = new Installation(
|
||||||
|
__DIR__.'/tmp',
|
||||||
|
__DIR__.'/tmp/public',
|
||||||
|
__DIR__.'/tmp/storage'
|
||||||
|
);
|
||||||
|
|
||||||
|
$pipeline = $installation
|
||||||
|
->configPath('config.php')
|
||||||
|
->debugMode(true)
|
||||||
|
->baseUrl('http://localhost')
|
||||||
|
->databaseConfig(new DatabaseConfig(
|
||||||
|
'mysql',
|
||||||
|
env('DB_HOST', 'localhost'),
|
||||||
|
intval(env('DB_PORT', 3306)),
|
||||||
|
env('DB_DATABASE', 'flarum_test'),
|
||||||
|
env('DB_USERNAME', 'root'),
|
||||||
|
env('DB_PASSWORD', ''),
|
||||||
|
env('DB_PREFIX', '')
|
||||||
|
))
|
||||||
|
->adminUser(new AdminUser(
|
||||||
|
'admin',
|
||||||
|
'secret',
|
||||||
|
'admin@flarum.email'
|
||||||
|
))
|
||||||
|
->settings(['mail_driver' => 'log'])
|
||||||
|
->build();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run the actual configuration
|
||||||
|
*/
|
||||||
|
|
||||||
|
$pipeline->run();
|
Reference in New Issue
Block a user