Mocking PHP functions in unit tests

前端 未结 4 2372
深忆病人
深忆病人 2021-02-13 17:52

I\'m unit-testing some PHP code with SimpleTest and I\'ve run into trouble. In my tests of a database class I want to be able to set an expectation for PHPs mysql f

4条回答
  •  天命终不由人
    2021-02-13 18:20

    There is a PHPUnit extension that uses runkit internally, and is capable to use invocation matchers, parameter constraints and everything a mocked object can do.

    https://github.com/tcz/phpunit-mockfunction

提交回复
热议问题