mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 04:34:03 +00:00
Add vhost_is_written test
This commit is contained in:
parent
094dc924e4
commit
2a33d0ec85
7 changed files with 105 additions and 7 deletions
|
|
@ -39,4 +39,56 @@ class ServerManagerTest extends TestCase
|
|||
|
||||
$this->assertSame("/etc/foo{$uuid}bar", $this->serverManager->getConfigFilePath());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function vhost_is_written()
|
||||
{
|
||||
[$tmpfile, $path, $vhost] = $this->setupCreateVhost();
|
||||
|
||||
$this->serverManager->createVhost('localhost');
|
||||
|
||||
$vhost = str_replace('%host%', 'localhost', $vhost);
|
||||
|
||||
$this->assertContains($vhost, fread($tmpfile, filesize($path)));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function cert_is_deployed()
|
||||
{
|
||||
[$tmpfile, $path, $vhost] = $this->setupCreateVhost();
|
||||
|
||||
$this->serverManager->createVhost('localhost');
|
||||
|
||||
dump(fread($tmpfile, filesize($path)));
|
||||
// todo
|
||||
// The following error was encountered:\n
|
||||
// [Errno 13] Permission denied: '/var/log/letsencrypt/.certbot.lock'\n
|
||||
// Either run as root, or set --config-dir, --work-dir, and --logs-dir to writeable paths.\n
|
||||
}
|
||||
|
||||
public function setupCreateVhost()
|
||||
{
|
||||
$tmpfile = tmpfile();
|
||||
$path = stream_get_meta_data($tmpfile)['uri'];
|
||||
|
||||
$vhost = "server {
|
||||
include includes/tenancy;
|
||||
server_name %host%;
|
||||
}";
|
||||
|
||||
config([
|
||||
'tenancy.server.nginx' => [
|
||||
'vhost' => $vhost,
|
||||
'extra_certbot_args' => [
|
||||
'--staging'
|
||||
],
|
||||
],
|
||||
'tenancy.server.file' => [
|
||||
'single' => true,
|
||||
'path' => $path,
|
||||
],
|
||||
]);
|
||||
|
||||
return [$tmpfile, $path, $vhost];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue