#!/usr/bin/env php
<?php
/**
 * Yii console bootstrap file.
 *
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');

require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';

use dimichspb\yii\mailqueue\Mailer;
use yii\console\Application;
use yii\queue\Queue;


$application = new Application([
   'id' => 'testapp',
   'basePath' => __DIR__,
   'vendorPath' => dirname(__DIR__) . '/vendor',
   'runtimePath' => dirname(__DIR__) . '/runtime',
   'bootstrap' => [
        dimichspb\yii\mailqueue\Bootstrap::class,
        'queue'
   ],
   'aliases' => [
       '@tests' => __DIR__,
   ],
   'components' => [
       'db' => [
           'class' => 'yii\db\Connection',
           'dsn' => 'sqlite:' . __DIR__ . '/../runtime/db/db.sql',
       ],
       'mailer' => [
           'class' => Mailer::className(),
           'mailerOptions' => [
               'useFileTransport' => true,
           ],
           'useFileTransport' => false,
       ],
       'queue' => [
           'class' => \yii\queue\file\Queue::class,
       ]
   ],
   'controllerMap' => [
       'migrate' => [
           'class' => 'yii\console\controllers\MigrateController',
           'migrationPath' => __DIR__ . '/../../src/migrations',
       ],
   ],
]);
$exitCode = $application->run();
exit($exitCode);