-
Notifications
You must be signed in to change notification settings - Fork 1
/
kahlan-config.php
44 lines (31 loc) · 995 Bytes
/
kahlan-config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
use Kahlan\Plugin\Double;
use Phalcon\Di\FactoryDefault as DefaultDi;
use Phalcon\Mvc\Collection\Manager as CollectionManager;
//constants
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
define('ROOT_PATH', dirname(dirname(__DIR__)));
define('SRC_PATH', ROOT_PATH . DS . 'src');
define('SPEC_PATH', ROOT_PATH . DS . 'spec');
define('TESTS_CONFIG_PATH', SPEC_PATH . DS . 'config');
define('TESTS_SUITE_PATH', SPEC_PATH . DS . 'suite');
//CLI override
$commandLine = $this->commandLine();
$commandLine->option('cc', 'default', true);
$commandLine->option('reporter', 'default', 'dot');
//Phalcon Services
$di = new DefaultDi();
$di->setShared('collectionManager', function () {
return Double::instance([
'extends' => CollectionManager::class
]);
});
$di->setShared('mongo', function () {
$server = 'mongodb://mongo';
$db = 'test';
$mongo = new \MongoClient($server);
$collection = $mongo->selectDB($db);
return $collection;
});