i am new to PHP testing and trying to build a simple project with TDD.
The simple idea was to make a simple Card/Deck setup of some kind.
I started writting tests and quickly started mashing up a CardDeck class and CardStack class from my failling tests. They both implemented some of the same methods, like getTop(), getTopStack().. so i decided implement a CardDeckInterface, a abstract class BaseCardStack, to dry it up.
After refactoring. CardDeck and CardStack extends BaseCardStack which implements the CardStackInterface.
The CardDeck and CardStack only differences is the construct and a few added functions to the CardStack. Else none of the implemented functions from BaseCardStack are overwritten.
This is where my troubles being. In my CardDeckTest i had tests tied to the implemented methods, that have been to moved the BaseCardDeck.
Should i keep my current tests in my CardDeckTest ( they still pass as before ) and write a extra set of tests for CardStackTest? This seems like the wrong solution as the methods are already tested and in no way differ (not overwritten), as i mentioned, the implemented methods from the BaseCardStack are not overwritten.
Instead i think that i should move/write tests for my abstract class.
Basicly i want to test the functions in my abstract class which i know will be implemented without being overwritten.
But how do i do this? Should i mock? Should i change my patterns?