Performing unit testing with nested dependencies and Factory classes

前端 未结 2 1290
南旧
南旧 2021-02-19 01:25

I\'m new to unit testing and PHPUnit, but I\'ve reading a lot lately about design patterns and isolated tests and I\'ve decided to refactor an application I\'m working on to get

2条回答
  •  青春惊慌失措
    2021-02-19 01:47

    You can test it with inheritance.

    Just extend House with a FakeHouse for testing, and then check $material, $door and $knob etc. whether they've changed or not after testing.

提交回复
热议问题