Performing unit testing with nested dependencies and Factory classes

前端 未结 2 831
庸人自扰
庸人自扰 2021-02-19 01:34

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:46

    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.

提交回复
热议问题