stackoverflow community. I'm new to PHPUnit (and unit testing as a whole). My question is this.
For example let's say I have function that's one of many functions in include/functions.php.
Let's say that function is addNumbers($a,$b) like a simple math function that isn't in some Math class, just a basic function in file that contains many other functions.
Is it possible to somehow mock this function with phpunit?
Can I just ' and do $this->getMockBuilder(addNumbers) or something like that since mocking functions as I can tell only accept classes ?
PHPUnit docs tells this - "The createStub($type) and createMock($type) methods immediately return a test double object for the specified type (interface or class)."
Now, I'm asking this question for real usage - I have addCustomer function that adds customer to the database. Can I mock database and mock that function so It really doesn't adds customer to the database, just tests if that works ?
Sorry, I'm really new and as far as I can tell I just can't google something like this.