granam / test-with-mockery
Mockery test helper ensuring mocked method exists
Installs: 321
Dependents: 54
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=7.3
- mockery/mockery: >=1.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- roave/security-advisories: dev-master
README
No more mocked non-existing methods after a method name change.
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; } }
Installation
composer require --dev granam/test-with-mockery