|
@@ 40-78 (lines=39) @@
|
| 37 |
|
$this->shouldImplement(UserDataTransformer::class); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
function it_transforms( |
| 41 |
|
User $user, |
| 42 |
|
\DateTimeImmutable $createdOn, |
| 43 |
|
\DateTimeImmutable $lastLogin, |
| 44 |
|
\DateTimeImmutable $updatedOn, |
| 45 |
|
FullName $fullName, |
| 46 |
|
Username $username, |
| 47 |
|
Image $image |
| 48 |
|
) { |
| 49 |
|
$this->read()->shouldReturn([]); |
| 50 |
|
|
| 51 |
|
$this->write($user); |
| 52 |
|
|
| 53 |
|
$user->id()->shouldBeCalled()->willReturn(new UserId('user-id')); |
| 54 |
|
$user->email()->shouldBeCalled()->willReturn(new UserEmail('[email protected]')); |
| 55 |
|
|
| 56 |
|
$user->username()->shouldBeCalled()->willReturn($username); |
| 57 |
|
$username->username()->shouldBeCalled()->willReturn('user11111'); |
| 58 |
|
|
| 59 |
|
$user->fullName()->shouldBeCalled()->willReturn($fullName); |
| 60 |
|
$fullName->firstName()->shouldBeCalled()->willReturn('The user first name'); |
| 61 |
|
$fullName->lastName()->shouldBeCalled()->willReturn('The user last name'); |
| 62 |
|
$fullName->fullName()->shouldBeCalled()->willReturn('The user first name The user last name'); |
| 63 |
|
|
| 64 |
|
$user->image()->shouldBeCalled()->willReturn($image); |
| 65 |
|
$imageName = new FileName('image-name.png'); |
| 66 |
|
$image->name()->shouldBeCalled()->willReturn($imageName); |
| 67 |
|
|
| 68 |
|
$this->read()->shouldReturn([ |
| 69 |
|
'id' => 'user-id', |
| 70 |
|
'user_id' => 'user-id', |
| 71 |
|
'email' => '[email protected]', |
| 72 |
|
'first_name' => 'The user first name', |
| 73 |
|
'full_name' => 'The user first name The user last name', |
| 74 |
|
'last_name' => 'The user last name', |
| 75 |
|
'image' => '/image-name.png', |
| 76 |
|
'user_name' => 'user11111', |
| 77 |
|
]); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
function it_transforms_with_other_upload_destination( |
| 81 |
|
User $user, |
|
@@ 80-120 (lines=41) @@
|
| 77 |
|
]); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
function it_transforms_with_other_upload_destination( |
| 81 |
|
User $user, |
| 82 |
|
\DateTimeImmutable $createdOn, |
| 83 |
|
\DateTimeImmutable $lastLogin, |
| 84 |
|
\DateTimeImmutable $updatedOn, |
| 85 |
|
FullName $fullName, |
| 86 |
|
Username $username, |
| 87 |
|
Image $image |
| 88 |
|
) { |
| 89 |
|
$this->beConstructedWith('/other-upload-destination'); |
| 90 |
|
|
| 91 |
|
$this->read()->shouldReturn([]); |
| 92 |
|
|
| 93 |
|
$this->write($user); |
| 94 |
|
|
| 95 |
|
$user->id()->shouldBeCalled()->willReturn(new UserId('user-id')); |
| 96 |
|
$user->email()->shouldBeCalled()->willReturn(new UserEmail('[email protected]')); |
| 97 |
|
|
| 98 |
|
$user->username()->shouldBeCalled()->willReturn($username); |
| 99 |
|
$username->username()->shouldBeCalled()->willReturn('user11111'); |
| 100 |
|
|
| 101 |
|
$user->fullName()->shouldBeCalled()->willReturn($fullName); |
| 102 |
|
$fullName->firstName()->shouldBeCalled()->willReturn('The user first name'); |
| 103 |
|
$fullName->lastName()->shouldBeCalled()->willReturn('The user last name'); |
| 104 |
|
$fullName->fullName()->shouldBeCalled()->willReturn('The user first name The user last name'); |
| 105 |
|
|
| 106 |
|
$user->image()->shouldBeCalled()->willReturn($image); |
| 107 |
|
$imageName = new FileName('image-name.png'); |
| 108 |
|
$image->name()->shouldBeCalled()->willReturn($imageName); |
| 109 |
|
|
| 110 |
|
$this->read()->shouldReturn([ |
| 111 |
|
'id' => 'user-id', |
| 112 |
|
'user_id' => 'user-id', |
| 113 |
|
'email' => '[email protected]', |
| 114 |
|
'first_name' => 'The user first name', |
| 115 |
|
'full_name' => 'The user first name The user last name', |
| 116 |
|
'last_name' => 'The user last name', |
| 117 |
|
'image' => '/other-upload-destination/image-name.png', |
| 118 |
|
'user_name' => 'user11111', |
| 119 |
|
]); |
| 120 |
|
} |
| 121 |
|
} |
| 122 |
|
|