PHPackages                             remarkablemark/rector-laravel-service-mocking - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. remarkablemark/rector-laravel-service-mocking

ActiveLibrary[Testing &amp; Quality](/categories/testing)

remarkablemark/rector-laravel-service-mocking
=============================================

Rector to replace deprecated Laravel service mocking testing methods

3.0.0(9mo ago)015[2 PRs](https://github.com/remarkablemark/rector-laravel-service-mocking/pulls)MITPHPPHP &gt;=8.2CI passing

Since Dec 11Pushed 2mo agoCompare

[ Source](https://github.com/remarkablemark/rector-laravel-service-mocking)[ Packagist](https://packagist.org/packages/remarkablemark/rector-laravel-service-mocking)[ Fund](https://www.buymeacoffee.com/remarkablemark)[ Fund](https://b.remarkabl.org/teespring)[ RSS](/packages/remarkablemark-rector-laravel-service-mocking/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (16)Used By (0)

rector-laravel-service-mocking
==============================

[](#rector-laravel-service-mocking)

[![packagist](https://camo.githubusercontent.com/928535f200e91049baad9cbd72511978a991e92fb27f94b4727e9cc2c964c475/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656d61726b61626c656d61726b2f726563746f722d6c61726176656c2d736572766963652d6d6f636b696e67)](https://packagist.org/packages/remarkablemark/rector-laravel-service-mocking)[![test](https://github.com/remarkablemark/rector-laravel-service-mocking/actions/workflows/test.yml/badge.svg)](https://github.com/remarkablemark/rector-laravel-service-mocking/actions/workflows/test.yml)

[Rector](https://github.com/rectorphp/rector) to replace deprecated Laravel service mocking testing methods such as `expectsEvents`, `expectsJobs`, and `expectsNotifications`.

From [Laravel 10](https://laravel.com/docs/10.x/upgrade#service-mocking):

> The deprecated `MocksApplicationServices` trait has been removed from the framework. This trait provided testing methods such as `expectsEvents`, `expectsJobs`, and `expectsNotifications`.
>
> If your application uses these methods, we recommend you transition to `Event::fake`, `Bus::fake`, and `Notification::fake`, respectively. You can learn more about mocking via fakes in the corresponding documentation for the component you are attempting to fake.

Requirements
------------

[](#requirements)

PHP &gt;=8.2

Install
-------

[](#install)

Install with [Composer](http://getcomposer.org/):

```
composer require --dev rector/rector remarkablemark/rector-laravel-service-mocking
```

Usage
-----

[](#usage)

Register the rule in `rector.php`:

```
