mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: update naming and add tests
This commit is contained in:
@@ -49,10 +49,10 @@ class Platform
|
||||
self::SCHEME_ANDROID => 'Android',
|
||||
self::SCHEME_WINDOWS => 'Windows',
|
||||
self::SCHEME_LINUX => 'Linux',
|
||||
self::SCHEME_CHROME_EXTENSION => 'Chrome Extension',
|
||||
self::SCHEME_FIREFOX_EXTENSION => 'Firefox Extension',
|
||||
self::SCHEME_SAFARI_EXTENSION => 'Safari Extension',
|
||||
self::SCHEME_EDGE_EXTENSION => 'Edge Extension',
|
||||
self::SCHEME_CHROME_EXTENSION => 'Web (Chrome Extension)',
|
||||
self::SCHEME_FIREFOX_EXTENSION => 'Web (Firefox Extension)',
|
||||
self::SCHEME_SAFARI_EXTENSION => 'Web (Safari Extension)',
|
||||
self::SCHEME_EDGE_EXTENSION => 'Web (Edge Extension)',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,10 +55,7 @@ class Origin extends Validator
|
||||
return $validator->isValid($this->host);
|
||||
}
|
||||
|
||||
if (!empty($this->scheme) &&
|
||||
in_array($this->scheme, $this->schemes, true) &&
|
||||
in_array($this->host, $this->hostnames, true)
|
||||
) {
|
||||
if (!empty($this->scheme) && in_array($this->scheme, $this->schemes, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,5 +94,17 @@ class OriginTest extends TestCase
|
||||
|
||||
$this->assertEquals(false, $validator->isValid('appwrite-windows://com.company.appname'));
|
||||
$this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console dashboard', $validator->getDescription());
|
||||
|
||||
$this->assertEquals(false, $validator->isValid('chrome-extension://com.company.appname'));
|
||||
$this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Chrome Extension) platform on your project console dashboard', $validator->getDescription());
|
||||
|
||||
$this->assertEquals(false, $validator->isValid('moz-extension://com.company.appname'));
|
||||
$this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Firefox Extension) platform on your project console dashboard', $validator->getDescription());
|
||||
|
||||
$this->assertEquals(false, $validator->isValid('safari-web-extension://com.company.appname'));
|
||||
$this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Safari Extension) platform on your project console dashboard', $validator->getDescription());
|
||||
|
||||
$this->assertEquals(false, $validator->isValid('ms-browser-extension://com.company.appname'));
|
||||
$this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Edge Extension) platform on your project console dashboard', $validator->getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user