PHPackages                             xp-devs/rector-verify - 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. xp-devs/rector-verify

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

xp-devs/rector-verify
=====================

Rector refactoring to migrate from PHPHunit assertions to Codeception/Verify expectations

0.2.1(12mo ago)02.2k↓33.3%MITPHPPHP &gt;=8.0CI passing

Since Mar 13Pushed 12mo ago1 watchersCompare

[ Source](https://github.com/xp-devs/rector-verify)[ Packagist](https://packagist.org/packages/xp-devs/rector-verify)[ RSS](/packages/xp-devs-rector-verify/feed)WikiDiscussions main Synced 1mo ago

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

Rector for Codeception Verify
=============================

[](#rector-for-codeception-verify)

This project lets you migrate from PHPUnit assertions to BDD style assertions [Codeception/Verify](https://github.com/Codeception/Verify)using automated refactoring powered by [Rector](https://github.com/rectorphp/rector)

Code before:

```
class GenericEventTest extends TestCase
{
    private GenericEvent $event;
    private \stdClass $subject;

    protected function setUp(): void
    {
        $this->subject = new \stdClass();
        $this->event = new GenericEvent($this->subject, ['name' => 'Event']);
    }

    public function testConstruct()
    {
        $this->assertEquals(new GenericEvent($this->subject, ['name' => 'Event']), $this->event);
    }

    /**
     * Tests Event->getArgs().
     */
    public function testGetArguments()
    {
        // test getting all
        $this->assertSame(['name' => 'Event'], $this->event->getArguments());
    }

    public function testSetArguments()
    {
        $result = $this->event->setArguments(['foo' => 'bar']);
        $this->assertSame(['foo' => 'bar'], $this->event->getArguments());
        $this->assertSame($this->event, $result);
    }
}
```

Code after:

```
class GenericEventTest extends TestCase
{
    private GenericEvent $event;
    private \stdClass $subject;

    protected function setUp(): void
    {
        $this->subject = new \stdClass();
        $this->event = new GenericEvent($this->subject, ['name' => 'Event']);
    }

    public function testConstruct()
    {
        expect($this->event)->toEqual(new GenericEvent($this->subject, ['name' => 'Event']));
    }

    /**
     * Tests Event->getArgs().
     */
    public function testGetArguments()
    {
        // test getting all
        expect($this->event->getArguments())->toBe(['name' => 'Event']);
    }

    public function testSetArguments()
    {
        $result = $this->event->setArguments(['foo' => 'bar']);
        expect($this->event->getArguments())->toBe(['foo' => 'bar']);
        expect($result)->toBe($this->event);
    }
}
```

Installation
------------

[](#installation)

You can install the package as a dev dependency:

```
composer require --dev xp-devs/rector-verify
```

Configuration
-------------

[](#configuration)

Add `AssertionVerifyRector` rule to your Rector config file

```
