Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Add the ability to publish and use test stubs #55

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

michaelr0
Copy link

@michaelr0 michaelr0 commented May 14, 2024

Q A
Bug fix? no
New feature? yes
Fixed tickets 0

Similar to pestphp/pest#596 this PR aims to allow the following Pest Tests stubs to be published into a Laravel project and modified for each specific project's requirements:

  • Browser.php
  • Dataset.php
  • Feature.php
  • Unit.php

The adjusted logic generates an outcome similar to the Laravel's existing artisan stub:publish and artisan make:test commands.

To publish the Pest stubs, the new artisan pest:publish command can be used, the stubs will be published as:

  • pest.browser.stub
  • pest.dataset.stub
  • pest.feature.stub
  • pest.unit.stub

These will then be found in the stubs directory on the project root.

The command behaves similarly to artisan stub:publish and has the --existing and --force options available for use.

artisan pest:dataset and artisan pest:test will generate files from the published stubs if they are present, otherwise the ones from the phppest/pest package will be used.

@michaelr0 michaelr0 changed the title Add the ability to publish and use test stubs [2.x] Add the ability to publish and use test stubs May 14, 2024
@michaelr0 michaelr0 force-pushed the publish-test-stubs branch from 79f8a70 to b83cceb Compare May 14, 2024 09:50
@jonjakoblich
Copy link

I was just looking for this exact feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants