Skip to content

Conversation

@carlos-granados
Copy link
Contributor

I want to start refactoring all existing tests to use the fixtures instead of creating the files on the fly. This PR refactors the "append snippets" test to use the fixtures

Behat\Behat\Tester\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
use Behat\Behat\Context\Context;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new fixture files must follow the coding standards of the project, so the expected output needs to be changed to also follow these standards. For example here we do not use use statements with multiple imports

}
private function doSomethingUndefinedWith() {}
private function useClasses(PyStringNode $node, TableNode $table)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we add some use statements we must have some code which actually uses these classes, otherwise the CS fixer will complain, so I added these dummy methods which just use these classes

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth having this as a code comment (partly in case a tool / someone feels like removing the unused method params in future)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good shout, updated

Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

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

Thanks @carlos-granados just a small suggestion.

It'll be great to get these all onto the newer fixture style :)

}
private function doSomethingUndefinedWith() {}
private function useClasses(PyStringNode $node, TableNode $table)
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth having this as a code comment (partly in case a tool / someone feels like removing the unused method params in future)?

@carlos-granados carlos-granados force-pushed the refactor-append-snippets-test branch from be3b62e to efccea0 Compare November 26, 2025 07:54
Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

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

Great, thanks @carlos-granados

@carlos-granados carlos-granados merged commit 4ef4f34 into Behat:3.x Nov 26, 2025
21 checks passed
@carlos-granados carlos-granados deleted the refactor-append-snippets-test branch November 26, 2025 10:15
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