-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b740a51
commit 77fe53a
Showing
9 changed files
with
305 additions
and
305 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<phpunit colors="true" | ||
verbose="true" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="FacelessLog Test Suite"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<log type="testdox-html" target="phpunit-report.html" /> | ||
</logging> | ||
</phpunit> | ||
<phpunit colors="true" | ||
verbose="true" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="FacelessLog Test Suite"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<log type="testdox-html" target="phpunit-report.html" /> | ||
</logging> | ||
</phpunit> |
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\BirthDateAnonymizer; | ||
|
||
class BirthDateAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new BirthDateAnonymizer(); | ||
} | ||
|
||
public function testAnonymizeWithDashedDateFormat() | ||
{ | ||
$originalMessage = "User's birth date is 1990-01-01."; | ||
$expectedMessage = "User's birth date is XXXX-XX-XX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithSlashedDateFormat() | ||
{ | ||
$originalMessage = "User's birth date is 01/01/1990."; | ||
$expectedMessage = "User's birth date is XX/XX/XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutDate() | ||
{ | ||
$originalMessage = "No date in this message."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\BirthDateAnonymizer; | ||
|
||
class BirthDateAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new BirthDateAnonymizer(); | ||
} | ||
|
||
public function testAnonymizeWithDashedDateFormat() | ||
{ | ||
$originalMessage = "User's birth date is 1990-01-01."; | ||
$expectedMessage = "User's birth date is XXXX-XX-XX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithSlashedDateFormat() | ||
{ | ||
$originalMessage = "User's birth date is 01/01/1990."; | ||
$expectedMessage = "User's birth date is XX/XX/XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutDate() | ||
{ | ||
$originalMessage = "No date in this message."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\CreditCardAnonymizer; | ||
|
||
class CreditCardAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new CreditCardAnonymizer(); | ||
} | ||
|
||
public function testAnonymizeCreditCardNumber() | ||
{ | ||
$originalMessage = "The credit card number is 1234-5678-9012-3456."; | ||
$expectedMessage = "The credit card number is 1234-XXXX-XXXX-XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithDifferentSeparators() | ||
{ | ||
$originalMessage = "Cards: 1234 5678 9012 3456, 1234.5678.9012.3456."; | ||
$expectedMessage = "Cards: 1234-XXXX-XXXX-XXXX, 1234-XXXX-XXXX-XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutCreditCardNumber() | ||
{ | ||
$originalMessage = "This message does not contain a credit card number."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\CreditCardAnonymizer; | ||
|
||
class CreditCardAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new CreditCardAnonymizer(); | ||
} | ||
|
||
public function testAnonymizeCreditCardNumber() | ||
{ | ||
$originalMessage = "The credit card number is 1234-5678-9012-3456."; | ||
$expectedMessage = "The credit card number is 1234-XXXX-XXXX-XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithDifferentSeparators() | ||
{ | ||
$originalMessage = "Cards: 1234 5678 9012 3456, 1234.5678.9012.3456."; | ||
$expectedMessage = "Cards: 1234-XXXX-XXXX-XXXX, 1234-XXXX-XXXX-XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutCreditCardNumber() | ||
{ | ||
$originalMessage = "This message does not contain a credit card number."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\EmailAnonymizer; | ||
|
||
class EmailAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new EmailAnonymizer(); | ||
} | ||
|
||
public function testAnonymizeEmailAddress() | ||
{ | ||
$originalMessage = "Contact me at [email protected]."; | ||
$expectedMessage = "Contact me at j***.d**@example.com."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeMultipleEmailAddresses() | ||
{ | ||
$originalMessage = "Emails: [email protected] and [email protected]."; | ||
$expectedMessage = "Emails: a****@example.com and b**@example.com."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutEmailAddress() | ||
{ | ||
$originalMessage = "This message does not contain an email address."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\EmailAnonymizer; | ||
|
||
class EmailAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new EmailAnonymizer(); | ||
} | ||
|
||
public function testAnonymizeEmailAddress() | ||
{ | ||
$originalMessage = "Contact me at [email protected]."; | ||
$expectedMessage = "Contact me at j***.d**@example.com."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeMultipleEmailAddresses() | ||
{ | ||
$originalMessage = "Emails: [email protected] and [email protected]."; | ||
$expectedMessage = "Emails: a****@example.com and b**@example.com."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutEmailAddress() | ||
{ | ||
$originalMessage = "This message does not contain an email address."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\PhoneAnonymizer; | ||
|
||
class PhoneAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new PhoneAnonymizer(); | ||
} | ||
|
||
public function testAnonymizePhoneNumber() | ||
{ | ||
$originalMessage = "Contact number is +123 4567 8901."; | ||
$expectedMessage = "Contact number is +123 4567 XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeMultiplePhoneNumbers() | ||
{ | ||
$originalMessage = "Numbers are (123) 456-7890 and 123.456.7890."; | ||
$expectedMessage = "Numbers are (123) 456-XXXX and 123.456.XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutPhoneNumber() | ||
{ | ||
$originalMessage = "This message does not contain a phone number."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Unit\Anonymizers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use FacelessLog\Anonymizers\PhoneAnonymizer; | ||
|
||
class PhoneAnonymizerTest extends TestCase | ||
{ | ||
private $anonymizer; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->anonymizer = new PhoneAnonymizer(); | ||
} | ||
|
||
public function testAnonymizePhoneNumber() | ||
{ | ||
$originalMessage = "Contact number is +123 4567 8901."; | ||
$expectedMessage = "Contact number is +123 4567 XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeMultiplePhoneNumbers() | ||
{ | ||
$originalMessage = "Numbers are (123) 456-7890 and 123.456.7890."; | ||
$expectedMessage = "Numbers are (123) 456-XXXX and 123.456.XXXX."; | ||
$this->assertEquals($expectedMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
|
||
public function testAnonymizeWithoutPhoneNumber() | ||
{ | ||
$originalMessage = "This message does not contain a phone number."; | ||
$this->assertEquals($originalMessage, $this->anonymizer->anonymize($originalMessage)); | ||
} | ||
} |
Oops, something went wrong.