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

fixes issue #13 with passing variables from and to sub-workflows #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sgehrig
Copy link

@sgehrig sgehrig commented Jan 17, 2018

This pull request fixes the issues described in #13.

Copy link
Member

@derickr derickr left a comment

Choose a reason for hiding this comment

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

I've had a few comments, but more importantly, this misses a test case, or test cases.

* http://www.apache.org/licenses/LICENSE-2.0
*
*
Copy link
Member

Choose a reason for hiding this comment

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

Please split white space changes out in a separate commit.

Copy link
Author

Choose a reason for hiding this comment

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

Oops. Sure.

$subVariables = [];
foreach ( $execution->getVariables() as $variableName => $data ) {
if ( isset($this->configuration['variables']['in'][$variableName]) ) {
$subVariables[$this->configuration['variables']['in'][$variableName]] = $data;
Copy link
Member

Choose a reason for hiding this comment

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

Coding standards want the { on a new line on its own, please.

Copy link
Author

Choose a reason for hiding this comment

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

Overlooked that. Uncommon coding style for me. Will be fixed.

@@ -188,9 +195,10 @@ public function execute( ezcWorkflowExecution $execution )
}

// Execution of Sub Workflow has been suspended.
$reverseInVariableMap = array_flip( $this->configuration['variables']['in'] );
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need to be flipped?

Copy link
Author

Choose a reason for hiding this comment

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

Given an interactive sub-workflow node which maps x on the parent workflow to y on the sub-workflow. The workflow used as sub-workflow now waits for its variable y to be set.
If sub-workflow is waiting for y the parent workflow is also waiting for a variable. But the parent is not waiting for y but for x because of the mapping. y is not even a variable known to the parent workflow.
I hope this is somehow understandable...

@sgehrig
Copy link
Author

sgehrig commented Jan 17, 2018

Regarding the failing test cases: regardless of running against master or the new fix I always get 26 errors and 24 warnings.

The warnings are due to deprecations in the mocking API in PHPUnit (when running on PHPUnit 5.7.26) and the errors are:

17 x missing hard dependency on WorkflowEventLogTiein being installed parallel to Workflow
9 x Illegal string offset 'operand' in Workflow/src/interfaces/node_arithmetic_base.php:114

I didn't see any tests that used interactive sub-workflows.

@derickr
Copy link
Member

derickr commented Jan 19, 2018

Hmm. OK. Would you be interested in making the test suite up to par first then? And hook them up to Travis as well? I know little about this component, I am not sure whether @sebastianbergmann is still interested in maintaining it either, so I am going to need some help with this one :-)

@sebastianbergmann
Copy link
Contributor

I am not interested in this anymore.

@sgehrig
Copy link
Author

sgehrig commented Jan 19, 2018

@derickr I'll fix the test suite sometime next week. I'm not very familiar with the contribution guidelines for zetacomponents, so: is it allowed to add e.g. the WorkflowEventLogTiein as a dev-dependency and remove this old hard dependency on the installation path?

What's the required PHP version compatibility for zetacomponents?

@derickr
Copy link
Member

derickr commented Jan 19, 2018

Curious, when I run the tests, I get this — nothing about WorkflowEventLogTiein:

derick@singlemalt:~/dev/zeta-new/Workflow $ php ~/phpunit-5.7.22.phar 
PHPUnit 5.7.22 by Sebastian Bergmann and contributors.

............................W..................................  63 / 283 ( 22%)
..............................WWWWEEWWWWWWWWEWWWWWWEEWWWWWWWWWW 126 / 283 ( 44%)
WWWWEEWW.E................WEE..........................EE....WW 189 / 283 ( 66%)
............................................................... 252 / 283 ( 89%)
...............................                                 283 / 283 (100%)

Time: 13.39 seconds, Memory: 14.00MB

There were 12 errors:

1) ezcWorkflowExecutionListenerTest::testEventsForIncrementingLoop
Illegal string offset 'operand'

/home/derick/dev/zeta-new/Workflow/src/interfaces/node_arithmetic_base.php:114
/home/derick/dev/zeta-new/Workflow/src/interfaces/execution.php:510
/home/derick/dev/zeta-new/Workflow/src/interfaces/execution.php:275
/home/derick/dev/zeta-new/Workflow/tests/execution_listener_test.php:99

This is with PHP 7.2.0, and PHPUnit 5.7.22.

I don't mind if you add WorkflowEventLogTiein as a dev-dependency, as long as the component can normally work without it being there.

I would suggest you look at the Travis config for Base: https://github.com/zetacomponents/Base/blob/master/.travis.yml

And as the lowest version we test on Travis is currently PHP 5.6 (I think because of PHPUnit version requirements), I'm OK with that being the lowest version. If there is no problem to make it work with PHP 5.3, then it would be good if you can at least manually test that once (or at least lint).

@sgehrig
Copy link
Author

sgehrig commented Jan 19, 2018

@derickr Do you have the WorkflowEventLogTiein installed in parallel to Workflow (/home/derick/dev/zeta-new/WorkflowEventLogTiein )? That's where the tests are looking for it.

@derickr
Copy link
Member

derickr commented Jan 19, 2018

Oh yes, I have that checked out next to it.

@sgehrig
Copy link
Author

sgehrig commented Jan 19, 2018

@derickr There's now a second PR (#16) that fixes the unit tests and adds the correct .travis.yml to setup Travis CI. See https://travis-ci.org/ipoint-bis/Workflow

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.

3 participants