Skip to content

Conversation

Plytas
Copy link
Contributor

@Plytas 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants