开发者

PHPUnit, Testing "Behaves Like A..."

I have a series of PHPUnit tests to validate a class, "Class A".

I have another class, "Class B" which extends Class A.

Is there a good way to test that "Class B passes Class A's tests", or开发者_JS百科 in other words "Class B behaves like Class A" without duplicating the test code?

I could test for the extends (using instanceof), but that seems like a misleading test.

I care that it behaves like Class A, not that it extends Class A, right? or wrong?


Just extend the PHPUnit test case of class A, for class B, that should do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜