Hi,
I am totally stuck in Robot Name. The returning tests keep saying that there aren’t enough arguments in the getName function. I wouldn’t know how to enter an argument except when the class is constructed with a constructor function or some other function that sets the name. I really don’t have a clue what to do now.
This is a test result :
Code Run
$this->assertMatchesRegularExpression('/^[a-z]{2}\d{3}$/i', $this->robot->getName());
Test Error
RobotNameTest::testHasName
ArgumentCountError: Too few arguments to function Robot::__construct(), 0 passed in RobotNameTest.php on line 39 and exactly 1 expected
RobotName.php:31
RobotNameTest.php:39
This is the instruction I’m trying to execute:
Manage robot factory settings.
When a robot comes off the factory floor, it has no name.
The first time you turn on a robot, a random name is generated in the format of two uppercase letters followed by three digits, such as RX837 or BC811.
This is what I’ve got so far
declare(strict_types=1);
class Robot
{
private string $name;
function __construct(string $robotName) {
$this->name = $robotName;
}
public function getName(): string {
return $this->name;
}
public function reset(): void
{
$robotName = $this->getName();
}
}