In #2844054: Inline Revisionable Content Blocks a new tempstorage service was created that needed to be split off into its own thing. it extends the core tempstore but imports DependencySerializationTrait, which allows it to be serialized where it would have failed before under certain circumstances (like trying to serialize unserializable services, like the current request or the database connection).

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review
Related issues: +#2844054: Inline Revisionable Content Blocks
StatusFileSize
new1.8 KB

All work is by EclipseGc and phenaproxima.

phenaproxima’s picture

This bit was actually done entirely by EclipseGc; I can claim no credit here.

phenaproxima’s picture

Title: Add tempstorage service (extracted from #2844054) » Add serializable tempstore service (extracted from #2844054)
Issue summary: View changes
darrenwh’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
+++ b/src/SerializableTempstore.php
@@ -0,0 +1,10 @@
+

Also can a test be added for this?

darrenwh’s picture

+++ b/src/SerializableTempstore.php
@@ -0,0 +1,10 @@
+

Needs a @file comment

Also can a test be added for this?

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.24 KB
new1.94 KB

Added some comments.

damienmckenna’s picture

Status: Needs review » Needs work

Still needs tests.

phenaproxima’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests +blocker
StatusFileSize
new3.27 KB
new2.39 KB

Okay, here's a simple test that should pretty much cover the reason why @EclipseGc wrote this class in the first place. I merged @Damien McKenna's changes in #7 into this too.

phenaproxima’s picture

I'd like @EclipseGc to sign off on that test before this gets RTBCed or committed, though.

damienmckenna’s picture

StatusFileSize
new1.33 KB

Test-only.

eclipsegc’s picture

Not certain the test is really doing anything testy yet. We should be serializing the tempstore object in the test and unserializing it and then ensuring we have known values from a service. It's important to note, there are services already passed to a tempstore object. The whole reason this patch even exists is because Drupal can add unserializable requests to the request stack, and tempstore was blowing up in those instances. The requestStack property isn't even accessible on tempstore objects, so you'll need to reflect the value back out of that. I don't think any values need to be set on the tempstore itself, it already has the stuff that will be problematic as a property of the object.

Eclipse

eclipsegc’s picture

Status: Needs review » Needs work

oops

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new4.1 KB
new1.66 KB

Okay, here we go. This should be asserting everything correctly.

Status: Needs review » Needs work

The last submitted patch, 14: 2858103-14.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new4.12 KB
new1.27 KB

Derp -- I did a little more experimenting and discovered that mocking __sleep() doesn't actually prove anything at all because it doesn't throw the LogicException (go figure). So I rewrote the mocked request using Prophecy and implementing \Serializable, which means that calling serialize() on the mocked request now definitely throws the exception.

Status: Needs review » Needs work

The last submitted patch, 16: 2858103-15.patch, failed testing.

phenaproxima’s picture

Status: Needs work » Needs review

Bullsh*t. There is a @group annotation in the test. Right there at the top. This is Drupal CI being wonky.

Status: Needs review » Needs work

The last submitted patch, 16: 2858103-15.patch, failed testing.

eclipsegc’s picture

StatusFileSize
new4.12 KB

Noticed that the test class name and file name had a capitalization difference. Let's see if the test passes now.

Eclipse

eclipsegc’s picture

Status: Needs work » Needs review

*sigh* me and the status field...

Status: Needs review » Needs work

The last submitted patch, 20: 2858103-20.patch, failed testing.

  • EclipseGc committed 8204ef7 on 8.x-3.x
    Issue #2858103 by phenaproxima, DamienMcKenna, EclipseGc: Add...
eclipsegc’s picture

Status: Needs work » Fixed

Ok, passes tests now.

Fixed

Status: Fixed » Closed (fixed)

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

darrenwh’s picture

So assume there is no point in doing code reviews if you don't get any credit?