Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Add partialMock shorthand #30202

Merged
merged 1 commit into from Oct 8, 2019

Conversation

@Plytas
Copy link
Contributor

Plytas commented Oct 7, 2019

This is similar to mock() but it makes a partial mock. Method name could also be changed to mockPartial()

So instead of

$this->instance(Abstract::class, Mockery::mock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
})->makePartial());

You can write

$this->partialMock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
});
This is similar to `mock()` but it makes a partial mock. Method name could also be changed to `mockPartial()`

So instead of
```PHP
$this->instance(Abstract::class, Mockery::mock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
})->makePartial());
```

You can write
```PHP
$this->partialMock(Abstract::class, function ($mock) {
    $mock->shouldReceive('call')->once();
});
```
@driesvints driesvints changed the title Add partialMock shorthand [6.x] Add partialMock shorthand Oct 7, 2019
@taylorotwell taylorotwell merged commit 850dffc into laravel:6.x Oct 8, 2019
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
kennith added a commit to kennith/docs that referenced this pull request Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.