-
-
Notifications
You must be signed in to change notification settings - Fork 117
/
IntegrationTestCase.php
38 lines (31 loc) · 1005 Bytes
/
IntegrationTestCase.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
<?php
namespace Phpactor\Filesystem\Tests\Adapter;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Filesystem\Filesystem;
abstract class IntegrationTestCase extends TestCase
{
protected function initWorkspace(): void
{
$filesystem = new Filesystem();
if ($filesystem->exists($this->workspacePath())) {
$filesystem->remove($this->workspacePath());
}
$filesystem->mkdir($this->workspacePath());
}
protected function workspacePath(): string
{
return realpath(__DIR__.'/..') . '/Workspace';
}
protected function loadProject(): void
{
$projectPath = __DIR__.'/project';
$filesystem = new Filesystem();
$filesystem->mirror($projectPath, $this->workspacePath());
chdir($this->workspacePath());
exec('composer dumpautoload 2> /dev/null');
}
protected function getProjectAutoloader(): string
{
return require __DIR__.'/project/vendor/autoload.php';
}
}