Skip to content

Add a new make:test command #807

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

Merged
merged 1 commit into from
Feb 6, 2021
Merged

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Feb 3, 2021

Replaces #806.

As a result of discussions with @weaverryan, this PR introduces a new generic test maker. It allows creating unit (PHPUnit), integration/service (WebTestCase) and E2E/UI (PantherTestCase) tests.

make:unit-test and make:functional-test have been deprecated, but BC is preserved.

@dunglas dunglas force-pushed the feat/make-test branch 2 times, most recently from 6a7cef0 to 2f748c3 Compare February 3, 2021 23:44
@jrushlow jrushlow added Feature New Feature Status: Needs Work Additional work is needed labels Feb 4, 2021
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
{
$testClassNameDetails = $generator->createClassNameDetails(
$input->getArgument('name'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever ask this interactively?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's delegated to the method in the abstract class.

class MakeFunctionalTestTest extends MakerTestCase
{
public function getTestDetails()
{
yield 'functional_maker' => [MakerTestDetails::createTest(
Copy link
Member Author

@dunglas dunglas Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing because of a bug in MakerTestCase. If a previous test (such as our new MakeTestTest) installs Panther, then the autoloader is confused for some reason and detects the dependency has always available even if it isn't, so the generated test extends PantherTestCase instead of WebTestCase. But when the test is executed in isolation, this time PantherTestCase isn't available, and it fails.

As this class is now deprecated, I don't think that it is worth it to fix MakerTestCase.

@weaverryan
Copy link
Member

Thanks Kévin!

@weaverryan weaverryan merged commit ed82536 into symfony:main Feb 6, 2021
weaverryan added a commit that referenced this pull request Feb 6, 2021
This PR was squashed before being merged into the 1.0-dev branch.

Discussion
----------

Tweaks to the new make:test

This follows #807 - I played with it locally and had some minor tweaks :).

Cheers!

Commits
-------

70f63b0 Tweaks to the new make:test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Status: Needs Work Additional work is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants