-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathTestCase.php
More file actions
82 lines (65 loc) · 2.15 KB
/
Copy pathTestCase.php
File metadata and controls
82 lines (65 loc) · 2.15 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace Tests;
use Illuminate\Filesystem\Filesystem;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Statamic\Providers\StatamicServiceProvider;
use Statamic\Statamic;
use Wilderborn\Partyline\ServiceProvider;
class TestCase extends OrchestraTestCase
{
protected $fixturePath = __DIR__.'/Fixtures';
protected $siteFixture = 'site';
protected function getPackageProviders($app)
{
return [
StatamicServiceProvider::class,
ServiceProvider::class,
\Statamic\StaticSite\ServiceProvider::class,
];
}
protected function getPackageAliases($app)
{
return [
'Statamic' => Statamic::class,
];
}
protected function setUp(): void
{
parent::setUp();
$this->files = app(Filesystem::class);
$this->copyDirectoryFromFixture('resources');
$this->copyDirectoryFromSiteFixture('content');
$this->app->instance('fork-installed', false);
}
protected function copyDirectoryFromFixture($directory, $site = null)
{
if (base_path($directory)) {
$this->files->deleteDirectory(base_path($directory));
}
$origin = vsprintf('%s/%s%s', [
$this->fixturePath,
$site ? "{$site}/" : '',
$directory,
]);
$this->files->copyDirectory($origin, base_path($directory));
}
protected function copyDirectoryFromSiteFixture($directory)
{
$this->copyDirectoryFromFixture($directory, $this->siteFixture);
}
protected function resolveApplicationConfiguration($app)
{
parent::resolveApplicationConfiguration($app);
$configs = [
'assets', 'cp', 'forms', 'routes', 'static_caching', 'stache', 'system', 'users',
];
foreach ($configs as $config) {
$app['config']->set("statamic.$config", require (__DIR__."/../vendor/statamic/cms/config/{$config}.php"));
}
}
protected function getEnvironmentSetUp($app)
{
$app['config']->set('auth.providers.users.driver', 'statamic');
$app['config']->set('statamic.users.repository', 'file');
}
}