# PHPUnit Enhancement Plugin Navigation

**Navigation** features connect PHPUnit and Mockery method strings to the mocked class methods for go to declaration, find usages, and rename refactoring.

---

## PHPUnit mock method references

**Feature ID:** `PhpUnitMockMethodReferences`  
**Feature Page:** [PHPUnit mock method references](https://espend.de/phpstorm/plugin/phpunit#php-unit-mock-method-references)  

Turns method strings in PHPUnit mock APIs into real references to the mocked class method. That enables go to declaration, find usages, and method rename refactoring from inside `method()`, `setMethods()`, and legacy PHPUnit mock builder strings.

### Code Examples

```php
# Navigate from method string to class method:
$gateway = $this->createMock(PaymentGateway::class);
$gateway->method('capt<caret>ure')->willReturn(true);
```

---

## createPartialMock reference support

**Feature ID:** `PhpUnitPartialMockReferences`  
**Feature Page:** [createPartialMock reference support](https://espend.de/phpstorm/plugin/phpunit#php-unit-partial-mock-references)  

Method names inside `createPartialMock()` arrays are references to the original class. Rename a class method and the partial mock declaration is updated with the rest of the project.

### Code Examples

```php
# Partial mock method reference:
$partial = $this->createPartialMock(PaymentGateway::class, ['capt<caret>ure']);
$partial->method('capture')->willReturn(true);
```

---

## Mockery method references and renaming

**Feature ID:** `MockeryMethodReferences`  
**Feature Page:** [Mockery method references and renaming](https://espend.de/phpstorm/plugin/phpunit#mockery-method-references)  

Adds references for Mockery method strings in parameter, array, and generated partial mock syntax. The contributor supports aliases, overloads, proxies, spies, runtime partial mocks, generated partial mocks, and class-string concatenation.

### Code Examples

```php
# References in expectation strings and arrays:
$repository = \Mockery::mock(UserRepository::class);
$repository->expects('fi<caret>nd')->andReturns($user);
$repository->shouldReceive(['fi<caret>nd' => $user]);
```

```php
# References in generated partial mocks:
$partial = \Mockery::mock(UserRepository::class . '[fi<caret>nd]');
$partial = \Mockery::mock('App\\Repository\\UserRepository[sa<caret>ve]');
```

---

