granam / test-with-mockery
Mockery 测试辅助器,确保存在模拟方法
2.0.0
2021-02-04 15:43 UTC
Requires
- php: >=7.3
- mockery/mockery: >=1.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- roave/security-advisories: dev-master
README
方法名更改后不再有非存在的模拟方法。
class MyTest extends \Granam\Tests\TestWithMockery { public function testMyClass() { $myClassMock = $this->mockery(Sos::class); $myClassMock->expects('saveMe') // saveMe() no more exists and \Granam\Tests\Exceptions\MockingOfNonExistingMethod is thrown ->andReturn(true); } } class Sos { // renamed previous saveMe() public function saveUs(): bool { return false; } }
安装
composer require --dev granam/test-with-mockery