1 <?php declare(strict_types=1);
3 namespace Tests\Commands;
7 class InitCommandTest extends TestCase
9 public function test_command_creates_an_instance_in_cwd()
11 $dir = $this->getEmptyTestDir();
14 $commandTester = $this->runCommand('init');
15 $commandTester->assertCommandIsSuccessful();
17 $this->assertFileExists($dir . '/vendor/autoload.php');
18 $this->assertFileExists($dir . '/.env');
20 $envData = file_get_contents($dir . '/.env');
21 $this->assertMatchesRegularExpression('/^APP_KEY=base64:.{30,60}$/m', $envData);
23 $output = $commandTester->getDisplay();
24 $this->assertStringContainsString("A BookStack install has been initialized at: " . $dir, $output);
26 $this->deleteDirectory($dir);