Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/registration.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-07-10 11:47:46 +0300
committerJoas Schilling <coding@schilljs.com>2020-08-28 21:39:37 +0300
commitfffb6278444e97b087955e903128a21701bc3b31 (patch)
treed083c519f0ab8bfa79bd2dd38fe7968e50ed93a2 /tests
parent0192fa9deb9892e3928e6f53df6f9cf1f635dfc5 (diff)
Make the email domain check case insensitive
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Integration/Service/RegistrationServiceTest.php34
1 files changed, 16 insertions, 18 deletions
diff --git a/tests/Integration/Service/RegistrationServiceTest.php b/tests/Integration/Service/RegistrationServiceTest.php
index 4130ffd..00413bf 100644
--- a/tests/Integration/Service/RegistrationServiceTest.php
+++ b/tests/Integration/Service/RegistrationServiceTest.php
@@ -60,7 +60,6 @@ class RegistrationServiceTest extends TestCase {
private $tokenProvider;
/** @var ICrypto */
private $crypto;
-
/** @var RegistrationService */
private $service;
@@ -105,31 +104,30 @@ class RegistrationServiceTest extends TestCase {
);
}
- public function testValidateNewEmail() {
- $email = 'aaaa@example.com';
-
- $this->config->expects($this->once())
- ->method('getAppValue')
- ->with('registration', 'allowed_domains', '')
- ->willReturn('');
-
- $this->service->validateEmail($email);
+ public function dataValidateEmail(): array {
+ return [
+ ['aaaa@example.com', ''],
+ ['aaaa@example.com', 'example.com'],
+ ['aaaa@example.com', 'eXample.com'],
+ ['aaaa@eXample.com', 'example.com'],
+ ];
}
- public function testValidateNewEmailWithinAllowedDomain() {
- $email = 'aaaa@example.com';
-
- $this->config->expects($this->atLeastOnce())
+ /**
+ * @dataProvider dataValidateEmail
+ * @param string $email
+ * @param string $allowedDomains
+ * @throws RegistrationException
+ */
+ public function testValidateEmail(string $email, string $allowedDomains) {
+ $this->config->expects($this->once())
->method('getAppValue')
->with('registration', 'allowed_domains', '')
- ->willReturn('example.com');
+ ->willReturn($allowedDomains);
$this->service->validateEmail($email);
}
- /**
- * @depends testValidateNewEmailWithinAllowedDomain
- */
public function testValidateNewEmailNotWithinAllowedDomain() {
$email2 = 'bbbb@gmail.com';