Skip to content

Introduce TermListPatcher and AliasGroupListPatcher#125

Merged
adrianheine merged 1 commit intomasterfrom
termlistpatcher
May 9, 2016
Merged

Introduce TermListPatcher and AliasGroupListPatcher#125
adrianheine merged 1 commit intomasterfrom
termlistpatcher

Conversation

@Benestar
Copy link
Copy Markdown
Contributor

This pull request is mainly about moving code around and creating a lot of test cases.

It consists of three commits that can be reviewed individually.

After this pull request, FingerprintPatcher is unused and can be removed. We have to make sure that all test cases in FingerprintPatcherTest are also present in TermListPatcherTest and AliasGroupListPatcher test.

To make the new classes actually useful, we have to move them out of the Internal namespace and make them package public.

Comment thread src/Diff/ItemPatcher.php
@@ -18,9 +19,14 @@
class ItemPatcher implements EntityPatcherStrategy {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Uh, this is weird in my opinion. Item and Property are guaranteed to have a Fingerprint. We do not win anything by using the smaller patchers here.

@Benestar
Copy link
Copy Markdown
Contributor Author

I removed the questioned commit from the chain.

new AliasGroup( 'en', array( 'foo', 'bar' ) )
) ),
new Diff( array(
'en' => new Diff( array( new DiffOpChange( 'bar', 'baz' ) ) )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a valid change. Why should this be a no-op? Especially since the very similar change below works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If I understand it correctly, that is basically what wmde/Diff#65 is about. I just wanted to test the current behaviour but we should change this test if the other pull request gets merged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in #131.

@Benestar
Copy link
Copy Markdown
Contributor Author

I notice there is never a true/false here, so all Diff instances rely on their "is associative" auto-detection. I would either avoid that or add tests for all three possible values true/false/null.

I didn't yet completely understand what the $isAssociative is about. Is it just the array of diffs that can be associative or linear? Anyways, it would perhaps be nice to do that in the actual test so that we don't have too much duplication.

PHPMD. :-(

Any idea how to fix that? Is it possible to disable the linting per file/method?

@JeroenDeDauw
Copy link
Copy Markdown
Contributor

I didn't yet completely understand what the $isAssociative is about. Is it just the array of diffs that can be associative or linear?

The diffs as well. See the first 3 sections in "usage" at https://github.com/wmde/Diff#usage

@JeroenDeDauw
Copy link
Copy Markdown
Contributor

To make the new classes actually useful, we have to move them out of the Internal namespace and make them package public.

Sounds good. I'm guessing this was not done so far as we actually had no need to expose those things. I don't actually recall the reason though.

@thiemowmde thiemowmde changed the title Introduce TermListPatcher and AliasGroupListPatcher [WIP] Introduce TermListPatcher and AliasGroupListPatcher Apr 25, 2016
@thiemowmde
Copy link
Copy Markdown
Contributor

thiemowmde commented Apr 25, 2016

Rebased. Note that this patch, as it is now, reverts #120! I suggest we fix #131 first before continuing to work on this.

@thiemowmde thiemowmde force-pushed the termlistpatcher branch 3 times, most recently from 583a06e to 72cd4d7 Compare April 27, 2016 08:17
@thiemowmde
Copy link
Copy Markdown
Contributor

Rebased again, on top of #120 and #131. All this patch now does is splitting the existing implementation (now without reverting anything) and adding tests. The only relevant detail I had to change in the tests was the one #131 fixed (see #125 (comment)). I also added a few more test cases with the "associative" flag set to true and false.

From my point of view this is ready to be merged.

Open questions (for other patches, should not block this one):

@thiemowmde thiemowmde changed the title [WIP] Introduce TermListPatcher and AliasGroupListPatcher Introduce TermListPatcher and AliasGroupListPatcher Apr 27, 2016
@adrianheine
Copy link
Copy Markdown
Contributor

Needs manual rebase

@thiemowmde thiemowmde modified the milestone: 3.6.0 May 4, 2016
@adrianheine adrianheine merged commit 7247aa0 into master May 9, 2016
@adrianheine adrianheine deleted the termlistpatcher branch May 9, 2016 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants