mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Test log command
This commit is contained in:
@@ -663,7 +663,7 @@ function (ConsoleCommandEvent $event) {
|
|||||||
'to your "'.Configuration::path().'" file.',
|
'to your "'.Configuration::path().'" file.',
|
||||||
]));
|
]));
|
||||||
|
|
||||||
exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($logs[$key])) {
|
if (! isset($logs[$key])) {
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ public function prepTestConfig(): void
|
|||||||
Configuration::createLogDirectory();
|
Configuration::createLogDirectory();
|
||||||
Configuration::createCertificatesDirectory();
|
Configuration::createCertificatesDirectory();
|
||||||
Configuration::writeBaseConfiguration();
|
Configuration::writeBaseConfiguration();
|
||||||
|
|
||||||
|
// Keep this file empty, as it's tailed in a test
|
||||||
|
Filesystem::touch(VALET_HOME_PATH.'/Log/nginx-error.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -994,7 +994,28 @@ public function test_which_php_command_reads_phprc()
|
|||||||
|
|
||||||
public function test_log_command()
|
public function test_log_command()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
[$app, $tester] = $this->appAndTester();
|
||||||
|
|
||||||
|
$tester->run(['command' => 'log']);
|
||||||
|
$tester->assertCommandIsSuccessful();
|
||||||
|
|
||||||
|
$this->assertStringContainsString('In order to tail a log', $tester->getDisplay());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_log_command_with_key()
|
||||||
|
{
|
||||||
|
[$app, $tester] = $this->appAndTester();
|
||||||
|
|
||||||
|
$tester->run(['command' => 'log', 'key' => 'nginx']);
|
||||||
|
$tester->assertCommandIsSuccessful();
|
||||||
|
|
||||||
|
// Can't test this because log's output is run via the tail command
|
||||||
|
// $this->assertStringContainsString('nginx-error-log-contents', $tester->getDisplay());
|
||||||
|
|
||||||
|
// So instead, we'll test *against* the negative states
|
||||||
|
$this->assertStringNotContainsString('does not (yet) exit', $tester->getDisplay());
|
||||||
|
$this->assertStringNotContainsString('No logs found', $tester->getDisplay());
|
||||||
|
$this->assertStringNotContainsString('In order to tail a log', $tester->getDisplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_directory_listing_command_reads()
|
public function test_directory_listing_command_reads()
|
||||||
|
|||||||
Reference in New Issue
Block a user