Skip to content

ghostwriter/mockery-rector

Repository files navigation

Mockery Rector

Compliance Supported PHP Version GitHub Sponsors Code Coverage Type Coverage Psalm Level Latest Version on Packagist Downloads

Rector extension for Mockery

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Installation

You can install the package via composer:

composer require rector/rector --dev
composer require ghostwriter/mockery-rector --dev

Usage

To add a set to your config, and pick one of constants:

  • Ghostwriter\MockeryRector\MockeryRectorSetList
  • Ghostwriter\MockeryRector\MockeryRectorLevelSetList
use Ghostwriter\MockeryRector\MockeryLevelSetList;
use Ghostwriter\MockeryRector\MockerySetList;
use Ghostwriter\MockeryRector\Rule\ExtendMockeryTestCaseRector;
use Ghostwriter\MockeryRector\Rule\HamcrestToPHPUnitRector;
use Ghostwriter\MockeryRector\Rule\PHPUnitToMockeryRector;
use Ghostwriter\MockeryRector\Rule\ProphecyToMockeryRector;
use Ghostwriter\MockeryRector\Rule\ShouldReceiveToAllowsRector;
use Ghostwriter\MockeryRector\Rule\ShouldReceiveToExpectsRector;
use Ghostwriter\MockeryRector\Rule\UseMockeryPHPUnitIntegrationTraitRector;

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        // ExtendMockeryTestCaseRector::class,
        // HamcrestToPHPUnitRector::class,
        // PHPUnitToMockeryRector::class,
        // ProphecyToMockeryRector::class,
        // ShouldReceiveToAllowsRector::class,
        // ShouldReceiveToExpectsRector::class,
        // UseMockeryPHPUnitIntegrationTraitRector::class,
    ])
    ->withSets([
         // version sets
         MockerySetList::MOCKERY_1_6, // v1.6.0
         MockerySetList::MOCKERY_2_0, // v2.0.0
         // or level sets
         MockeryLevelSetList::UP_TO_MOCKERY_1_6, // v0.1.0 - v1.6.0
         MockeryLevelSetList::UP_TO_MOCKERY_2_0, // v0.1.0 - v2.0.0
         // or migration sets
         MockerySetList::PHPUNIT_TO_MOCKERY, // PHPUnit to Mockery
         MockerySetList::PROPHECY_TO_MOCKERY, // Prophecy to Mockery
    ]);

Mockery Rector Rules

To see all the rules, check the docs/rector_rules_overview.md file.

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.