I am fresher working in PHP and I want to unit test a method which does not returns anything but just sets value to an object. My code is like this
class User
{
private $name;
private $email;
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): void
{
$this->name = $name;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): void
{
$this->email = $email;
}
}
The class I want to test is like this
class UserMapper
{
public function map(User $user): void
{
$user->setName("abc");
$user->setemail("abc@example.com")
}
}
How can I test this map function with PHPUnit mock?