-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from loic425/features/improve-user-and-custom…
…er-entities Improve user and customer entities
- Loading branch information
Showing
9 changed files
with
215 additions
and
62 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace spec\App\Entity; | ||
|
||
use App\Entity\AdminUser; | ||
use App\Entity\AdminUserInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; | ||
use Sylius\Component\User\Model\User; | ||
use Sylius\Component\User\Model\UserInterface; | ||
|
||
class AdminUserSpec extends ObjectBehavior | ||
{ | ||
function it_extends_a_base_user_model(): void | ||
{ | ||
$this->shouldHaveType(User::class); | ||
} | ||
|
||
function it_implements_an_admin_user_interface(): void | ||
{ | ||
$this->shouldImplement(AdminUserInterface::class); | ||
} | ||
|
||
function it_implements_a_user_interface(): void | ||
{ | ||
$this->shouldImplement(UserInterface::class); | ||
} | ||
|
||
function it_has_no_first_name_by_default(): void | ||
{ | ||
$this->getFirstName()->shouldReturn(null); | ||
} | ||
|
||
function its_first_name_is_mutable(): void | ||
{ | ||
$this->setFirstName('John'); | ||
$this->getFirstName()->shouldReturn('John'); | ||
} | ||
|
||
function it_has_no_last_name_by_default(): void | ||
{ | ||
$this->getLastName()->shouldReturn(null); | ||
} | ||
|
||
function its_last_name_is_mutable(): void | ||
{ | ||
$this->setLastName('Doe'); | ||
$this->getLastName()->shouldReturn('Doe'); | ||
} | ||
} |
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,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of AppName. | ||
* | ||
* (c) Monofony | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Entity; | ||
|
||
use Sylius\Component\User\Model\UserInterface as BaseUserInterface; | ||
|
||
interface AdminUserInterface extends BaseUserInterface | ||
{ | ||
public const DEFAULT_ADMIN_ROLE = 'ROLE_ADMIN'; | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getFirstName(): ?string; | ||
|
||
/** | ||
* @param string|null $firstName | ||
*/ | ||
public function setFirstName(?string $firstName): void; | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getLastName(): ?string; | ||
|
||
/** | ||
* @param string|null $lastName | ||
*/ | ||
public function setLastName(?string $lastName): void; | ||
} |
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,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of AppName. | ||
* | ||
* (c) Monofony | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Entity; | ||
|
||
use Sylius\Component\Customer\Model\CustomerAwareInterface; | ||
use Sylius\Component\User\Model\UserInterface; | ||
|
||
interface AppUserInterface extends UserInterface, CustomerAwareInterface | ||
{ | ||
} |
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
Oops, something went wrong.