Some people believe that in order to do true "unit testing" you must write code in your tests that isolates the component you are testing from every other component in the system – even that component's internal dependencies. Some even believe that this "true unit testing" is the holy grail that all testing should aspire to. This approach is often misguided, for the following reasons.
An advantage of having tests for individual components is that when the system changes, you have to update fewer unit tests than you have to update with integration tests or end to end tests. If you make your tests more complex in order to isolate the component under test, that complexity could defeat this advantage, because you're adding more test code that has to be kept up to date anyway.
For example, imagine you want to test an email sending module that takes an object representing a user of the system, and sends an email to that user. You could invent a "fake" user object – a completely separate class...