In phpspec can i mock the return value of a method?
for example:
class MyClass()
{
public function getStaffMemberNames()
{
// db call to get array of staff member names
}
public function sortStaffMemberNames()
{
return sort($this->getStaffMemberNames());
}
}
I am interested in testing the sortStaffMemberNames method. But it relies on another class method which uses a db connection. I want to mock the getStaffMemberNames so i can easily test.
How can this be achieved?