Fix more tests

This commit is contained in:
Matej Bačo
2025-04-25 14:13:22 +02:00
parent 8ce3bdb6d7
commit 7ae2c1bb2e
4 changed files with 22 additions and 3 deletions
@@ -101,6 +101,10 @@ class Create extends Action
if (\in_array($domain, $deniedDomains)) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.');
}
if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.');
}
try {
$domain = new Domain($domain);
@@ -107,6 +107,10 @@ class Create extends Action
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.');
}
if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.');
}
try {
$domain = new Domain($domain);
} catch (\Throwable) {
@@ -105,6 +105,10 @@ class Create extends Action
if (\in_array($domain, $deniedDomains)) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.');
}
if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.');
}
try {
$domain = new Domain($domain);
@@ -63,13 +63,20 @@ class ProxyCustomServerTest extends Scope
{
$domain = \uniqid() . '-vcs.myapp.com';
$rule = $this->createAPIRule('commit-' . $domain);
$setup = $this->setupSite();
$siteId = $setup['siteId'];
$deploymentId = $setup['deploymentId'];
$this->assertNotEmpty($siteId);
$this->assertNotEmpty($deploymentId);
$rule = $this->createSiteRule('commit-' . $domain, $siteId);
$this->assertEquals(400, $rule['headers']['status-code']);
$rule = $this->createAPIRule('branch-' . $domain);
$rule = $this->createSiteRule('branch-' . $domain, $siteId);
$this->assertEquals(400, $rule['headers']['status-code']);
$rule = $this->createAPIRule('anything-' . $domain);
$rule = $this->createSiteRule('anything-' . $domain, $siteId);
$this->assertEquals(201, $rule['headers']['status-code']);
$this->cleanupRule($rule['body']['$id']);
}