I am just starting with phpunit and this is where I have little problem now. The class I'm writing a test for, has a Logger method which when called, adds the timestamp to a property, Like this:
$this->logger->info('Log created', [
'user_id' => $order->getCustomerId(),
'time' => microtime(true),
]);
Now in my test class after creating a new mock object of that class, this is how I check to see if some given mock data equals to my logger:
$this->logger
->expects($this->once())
->method('info')
->with(
$this->equalTo('Campaign code created'),
$this->equalTo(['user_id' => 2000, 'time' => **??**])
);
How can I change the question marks to assert this array equal to the time when it gets created? Or is there a way that I can't check this property at all? because right now without the time property it throws an error.