// docs / migrating-from-phpunit-guide

Migrating from PHPUnit

Pest is built on top of PHPUnit, so migrating from PHPUnit to Pest is a simple process you may complete in a few steps. Once you have Pest installed, you should require the pestphp/pest-plugin-drift package as a "dev" dependency in your project:

1composer require pestphp/pest-plugin-drift --dev

Drift is a simple, yet powerful plugin that will automatically convert your PHPUnit tests to Pest when you run the --drift option:

1./vendor/bin/pest --drift

Typically, a PHPUnit test looks like this:

1<?php
2 
3namespace Tests\Unit;
4 
5use PHPUnit\Framework\TestCase;
6 
7class ExampleTest extends TestCase
8{
9 public function test_that_true_is_true(): void
10 {
11 $this->assertTrue(true);
12 }
13}

After running --drift, it will look like this:

1test('true is true', function () {
2 expect(true)->toBeTrue();
3});

Converting Tests Within a Specific Folder

Sometimes you may wish to convert the PHPUnit tests within a certain folder only. To accomplish this, you may pass a path as the first argument when calling --drift. For example, you may run the conversion for the tests/Helpers folder:

1./vendor/bin/pest --drift tests/Helpers

The output will contain a summary of the conversion process, as well as a list of the files that were converted:

1./vendor/bin/pest --drift tests/Helpers
2
3✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔✔
4
5INFO The [tests/Helpers] directory has been migrated to PEST with XY files changed.

While most of your tests will be converted automatically, and you should be able to run them without any issues, there are some cases where you may need to convert a few of your tests manually.


Of course, this particular chapter is only for those who are migrating from PHPUnit. Next, let's learn how you may contribute to the growth of Pest: Community Guide