AbstractConfigTest.php
1.73 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Test\Phinx\Config;
/**
* Class AbstractConfigTest
* @package Test\Phinx\Config
* @group config
* @coversNothing
*/
abstract class AbstractConfigTest extends \PHPUnit_Framework_TestCase
{
/**
* @var string
*/
protected $migrationPath = null;
/**
* Returns a sample configuration array for use with the unit tests.
*
* @return array
*/
public function getConfigArray()
{
return array(
'default' => array(
'paths' => array(
'migrations' => '%%PHINX_CONFIG_PATH%%/testmigrations2',
'seeds' => '%%PHINX_CONFIG_PATH%%/db/seeds',
)
),
'paths' => array(
'migrations' => $this->getMigrationPath(),
),
'templates' => array(
'file' => '%%PHINX_CONFIG_PATH%%/tpl/testtemplate.txt',
'class' => '%%PHINX_CONFIG_PATH%%/tpl/testtemplate.php'
),
'environments' => array(
'default_migration_table' => 'phinxlog',
'default_database' => 'testing',
'testing' => array(
'adapter' => 'sqllite',
'wrapper' => 'testwrapper',
'path' => '%%PHINX_CONFIG_PATH%%/testdb/test.db'
),
'production' => array(
'adapter' => 'mysql'
)
)
);
}
/**
* Generate dummy migration path
* @return string
*/
protected function getMigrationPath()
{
if (null === $this->migrationPath) {
$this->migrationPath = uniqid('phinx', true);
}
return $this->migrationPath;
}
}