Reputation: 31
I writing tests with Codeception framework. I am trying to use \Codeception\Stub::update for update method in existing stub, but it isn't work.
$this->userServiceStub = Stub::make(User::class, [
'getService' => function() use ($serviceStub) {
return $serviceStub;
},
'getFields' => [
'ID' => 1234,
'NAME' => 'First Test User',
],
]);
$this->userServiceStub = Stub::update($this->userServiceStub, [
'getFields' => [
'ID' => 1234,
'NAME' => 'Second Test User',
]
]);
When i use getFields method i see old NAME "First Test User". How to use Stub::update correctly?
Upvotes: 3
Views: 165