-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Issue #5: Static variables prevents running validation with differe…
…nt configuration
- Loading branch information
Showing
6 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,24 @@ public function testValidateExplicit(): void | |
'checkDisposableEmail' => false | ||
]; | ||
$validator = new DisposableEmailValidator(new Policy($policy)); | ||
self::assertEquals(true, $validator->validate(new EmailAddress('[email protected]'))); | ||
self::assertTrue($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
|
||
public function testValidateDefault(): void | ||
{ | ||
$validator = new DisposableEmailValidator(new Policy()); | ||
self::assertEquals(true, $validator->validate(new EmailAddress('[email protected]'))); | ||
self::assertTrue($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
|
||
public function testValidateClientProvidedDomain(): void | ||
{ | ||
$policy = [ | ||
'checkDisposableEmail' => true, | ||
'disposableList' => [ | ||
'example.com' | ||
], | ||
]; | ||
$validator = new DisposableEmailValidator(new Policy($policy)); | ||
self::assertFalse($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,24 @@ public function testValidateExplicit(): void | |
'checkFreeEmail' => false | ||
]; | ||
$validator = new FreeEmailValidator(new Policy($policy)); | ||
self::assertEquals(true, $validator->validate(new EmailAddress('[email protected]'))); | ||
self::assertTrue($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
|
||
public function testValidateDefault(): void | ||
{ | ||
$validator = new FreeEmailValidator(new Policy()); | ||
self::assertEquals(true, $validator->validate(new EmailAddress('[email protected]'))); | ||
self::assertTrue($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
|
||
public function testValidateClientProvidedDomain(): void | ||
{ | ||
$policy = [ | ||
'checkFreeEmail' => true, | ||
'freeList' => [ | ||
'example.com' | ||
], | ||
]; | ||
$validator = new FreeEmailValidator(new Policy($policy)); | ||
self::assertFalse($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,15 @@ public function testValidate(): void | |
'checkMxRecords' => false | ||
]; | ||
$validator = new MxValidator(new Policy($policy)); | ||
self::assertEquals(true, $validator->validate(new EmailAddress('[email protected]'))); | ||
self::assertTrue($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
|
||
public function testValidateDns(): void | ||
{ | ||
$policy = [ | ||
'checkMxRecords' => true | ||
]; | ||
$validator = new MxValidator(new Policy($policy)); | ||
self::assertTrue($validator->validate(new EmailAddress('[email protected]'))); | ||
} | ||
} |