-
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.
access to email suprresed for user that not is admin
- Loading branch information
1 parent
4833e37
commit e90a4a5
Showing
10 changed files
with
123 additions
and
46 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Infra\Services\Framework; | ||
|
||
use Illuminate\Pagination\LengthAwarePaginator; | ||
|
||
class DefaultPaginationConverter | ||
{ | ||
public static function convert( | ||
mixed $collectionBase, | ||
LengthAwarePaginator $lengthAwarePaginator | ||
): mixed { | ||
return $collectionBase | ||
->setCurrentPage($lengthAwarePaginator->currentPage()) | ||
->setFirstPageUrl($lengthAwarePaginator->url(1)) | ||
->setFrom($lengthAwarePaginator->firstItem()) | ||
->setLastPage($lengthAwarePaginator->lastPage()) | ||
->setLastPageUrl($lengthAwarePaginator->url($lengthAwarePaginator->lastPage())) | ||
->setLinks($lengthAwarePaginator->linkCollection()->toArray()) | ||
->setNextPageUrl($lengthAwarePaginator->nextPageUrl()) | ||
->setPath($lengthAwarePaginator->path()) | ||
->setPerPage($lengthAwarePaginator->perPage()) | ||
->setPrevPageUrl($lengthAwarePaginator->previousPageUrl()) | ||
->setTo($lengthAwarePaginator->lastItem()) | ||
->setTotal($lengthAwarePaginator->total()); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
use Core\Support\Http\ResponseStatus; | ||
use Tests\TestCase; | ||
|
||
/** | ||
* @group email_value_objects | ||
*/ | ||
class EmailValueObjectTest extends TestCase | ||
{ | ||
public function test_valid_email() | ||
|
@@ -34,4 +37,22 @@ public function test_unsuppressed_email() | |
$this->assertEquals('te**@ex*********', $email->supress()); | ||
$this->assertEquals('[email protected]', $email->unsupress()); | ||
} | ||
|
||
public function test_is_email_suppressed() | ||
{ | ||
$this->assertTrue(EmailValueObject::isEmailSuppressed('te**@ex*********')); | ||
$this->assertFalse(EmailValueObject::isEmailSuppressed('[email protected]')); | ||
} | ||
|
||
public function test_is_valid_email() | ||
{ | ||
$this->assertTrue((new EmailValueObject('[email protected]', false))->isValid()); | ||
$this->assertFalse((new EmailValueObject('invalid-email', false))->isValid()); | ||
} | ||
|
||
public function test_is_invalid_email() | ||
{ | ||
$this->assertFalse((new EmailValueObject('[email protected]', false))->isInvalid()); | ||
$this->assertTrue((new EmailValueObject('invalid-email', false))->isInvalid()); | ||
} | ||
} |