8000 [TwigBridge] Fix workflow test with deps=low by Simperfit · Pull Request #25458 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBridge] Fix workflow test with deps=low #25458

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

Conversation

Simperfit
Copy link
Contributor
@Simperfit Simperfit commented Dec 12, 2017
Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR none

In the original PR the tests were not failling but we should not use the new feature with deps=low until it fetch the branch with the new feature. So this fix the test for the WorkflowExtension in TwigBridge.

@nicolas-grekas
Copy link
Member
nicolas-grekas commented Dec 12, 2017

Should we plan to remove all the new @legacy method? Won't that reduce the test coverage?
Shouldn't we instead upgrade the test suite to use the not-deprecated API (and keep a few legacy calls just to ensure the legacy way keeps working)?
Feels like so to me.

@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Dec 12, 2017
@Simperfit
Copy link
Contributor Author
Simperfit commented Dec 12, 2017 via email

@chalasr
Copy link
Member
chalasr commented Dec 12, 2017

Keeping these legacy tests do not make sense to me either. setUp() should just use the right api based on method existence (the actual code does not even use this part of the api, only the test does).

@Simperfit
Copy link
Contributor Author
Simperfit commented Dec 12, 2017 via email

@chalasr
Copy link
Member
chalasr commented Dec 12, 2017

IMO there is no deprecation to assert here.
We want to keep 3.x compatibility, the test should just use the right api i.e. $registry->{method_exists($registry, $_ = 'addWorkflow') ? $_ : 'add'}($workflow, ...);, no possible deprecation as the new api is used if it exists.

@Simperfit Simperfit force-pushed the bugfix/fix-workflow-test-with-low-deps branch from df5c849 to 323168e Compare December 12, 2017 10:36
@Simperfit
Copy link
Contributor Author

We can remove the deprecation tag ;)

@@ -57,25 +38,10 @@ protected function setUpLegacyAdd()
$workflow = new Workflow($definition);

$registry = new Registry();
$registry->add($workflow, new InstanceOfSupportStrategy(\stdClass::class));

$registry->{method_exists($registry, $_ = 'addWorkflow') ? $_ : 'add'}($workflow, new InstanceOfSupportStrategy(\stdClass::class));
Copy link
Member

Choose a reason for hiding this comment

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

$addWorkflow = method_exists($registry, 'addWorkflow') ? 'addWorkflow' : 'add';
$registry->$addWorkflow($workflow, new InstanceOfSupportStrategy(\stdClass::class));

@Simperfit Simperfit force-pushed the bugfix/fix-workflow-test-with-low-deps branch 2 times, most recently from 1cd637b to 1586984 Compare December 12, 2017 10:51
$addWorkflow = method_exists($registry, 'addWorkflow') ? 'addWorkflow' : 'add';
$supportStrategy = class_exists('Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy')
? new \Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy(\stdClass::class)
: new \Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy(\stdClass::class);
Copy link
Member

Choose a reason for hiding this comment

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

please keep using use statements :)

@Simperfit Simperfit force-pushed the bugfix/fix-workflow-test-with-low-deps branch from 1586984 to e5c6b92 Compare December 12, 2017 10:54
@Simperfit
Copy link
Contributor Author

🍾 it's green !

@nicolas-grekas
Copy link
Member

Thank you @Simperfit.

@nicolas-grekas nicolas-grekas merged commit e5c6b92 into symfony:master Dec 12, 2017
nicolas-grekas added a commit that referenced this pull request Dec 12, 2017
This PR was merged into the 4.1-dev branch.

Discussion
----------

[TwigBridge] Fix workflow test with deps=low

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

In the original PR the tests were not failling but we should not use the new feature with deps=low until it fetch the branch with the new feature. So this fix the test for the WorkflowExtension in TwigBridge.

Commits
-------

e5c6b92 [TwigBridge] Fix workflow test with deps=low
@Simperfit Simperfit deleted the bugfix/fix-workflow-test-with-low-deps branch December 12, 2017 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0