Problem/Motivation

Add $storage and $expressionManager properties to avoid repeating the code in the test functions.

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new7.6 KB
tr’s picture

Status: Needs review » Postponed

This would be disruptive to commit at the moment, because of all the other outstanding patches that modify these same test functions.

jonathan1055’s picture

Issue summary: View changes

How about commiting just the first two hunks, which only alter setUp()? Then when working on these tests in other issues, the changes can incorporate the use of the new stored properties. There will probably never be a time when there is nothing conflicting with other patches. So having this issue postponed may mean it gets forgotten. Just an idea ...

tr’s picture

There are other things I'd like to fix but haven't opened the issues yet. For example, static analysis complains about calling User methods on variables typed as AccountInterface. That one will touch every test case.

I think at some point we're just going to have to schedule a day to commit all outstanding test changes, so that we only have to re-roll affected patches once instead of dealing with the changes one-by-one.

Also I would like to look into refactoring this test in some way so that it doesn't have to be modified for every single patch.

jonathan1055’s picture

OK I see.

Also I would like to look into refactoring this test in some way so that it doesn't have to be modified for every single patch.

Yes that would be good. When #3255074: Improve ConfigureAndExecute test is done it will remove the outstanding test changes from the Select List issue. So it would be good if you could do that first.

tr’s picture

Status: Postponed » Needs review
StatusFileSize
new1.38 KB

How about commiting just the first two hunks, which only alter setUp()?

OK, let's try that for now. Here's the patch.

tr’s picture

StatusFileSize
new1.61 KB

Let's also fix the datatype for $account, as this is wrong as per static analysis. It shouldn't be AccountInterface, it should be UserInterface. We're doing lots of things like $this->account->addRole('test-editor'), but you can't add a role to an AccountInterface.

  • TR committed 3f7bbf2 on 8.x-3.x
    Issue #3253927 by TR: ConfigureAndExecuteTest: Move some repeated code...
tr’s picture

Committed #8, leaving open to remind us to clean up the test cases as per #4.

jonathan1055’s picture

StatusFileSize
new3.75 KB

Here's a patch which uses the new properties in all the remaining tests within the class. I have checked the issues which I've been working on, and this will not cause any clashes which require existing patches to be re-rolled. Specifically it will not cause any clashes in
#2471481: Integrate Typed Data Widgets
#2664280: Select lists in action & condition configuration forms
#2723259: Allow single-valued data selector input to be passed as an array for 'multiple' context fields
#2816157: Simplify UserHasRole::doEvaluate()
#3059402: Set data action in referenced entity.
#3103808: ConfigureAndExecuteTest creates malformed Rules
#3110593: Add conditions for Date Check and Date in Range

I have not gone through every 8.x 'needs work' or 'needs review' issue, but I don't think there are many others which alter that test file. If you know of others tell me. But now seems a good time to commit this.


Edit: Actually I have found one issue #3259453: Rename all Rules events which will clash with this patch. But it is easy to fix.

  • TR committed 7d79409 on 8.x-3.x authored by jonathan1055
    Issue #3253927 by TR, jonathan1055: ConfigureAndExecuteTest: Move some...
tr’s picture

Status: Needs review » Fixed

OK, looks good. Thanks. Committed #11.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.