R
R
Roman Sarvarov2021-03-06 16:12:02
Software testing
Roman Sarvarov, 2021-03-06 16:12:02

Tests - one class and many methods or many classes - few methods?

I can't figure out how best to create tests.
Let's say I need to test the functionality of the application with some model.
Do I need to make a ModelTest.php test and it has a lot of methods, or is it better to separate classes and make it like UserObserverTest, UserRepositoryTest, UserMiddlewareTest and so on?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-03-06
@megakor

The second option is better - you do not need to collect everything in one heap.
So at least if you change UserRepository, you already know that you need to add / change theta in UserRepositoryTests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question