Port OG-Context module as OgContext provider#180
Conversation
…reated during tests.
…at it is clear that tests need to implement this.
|
This still needs a test for I feel hesitant to write a functional test for this, since we would have to provide a test module that contains "something" (e.g. a block or a page controller) that consumes the available context and outputs data about it that we can check. For me providing a test module specifically for this seems overkill. Also I have more fun things to do in my spare time than waiting for functional tests to run 😁 A unit test will be quite complicated since much of the business logic in in protected methods, so this would mean that we need to do a ton of mocking. Maybe a kernel test would be a solution, but this functionality relies on requests being made, which is normally in the domain of functional tests. I don't know how to 'fake' a request in a kernel test. I will investigate this further in the weekend. For the moment I'm pretty happy with how this is turning out. It also seems to work quite nice in practice. I just replaced our project's custom context provider with this and ran our entire Behat test suite against it and it came back green. |
This was giving different results on different versions of PHP. The PHP manual states: "If two members compare as equal, their relative order in the sorted array is undefined.".
|
This will require a re-roll now. |
|
Thanks for letting me know. Going to pick this back up! |
|
Haha thanks for the compliment! :) I'm having great fun writing these, it's like a bunch of little puzzles to solve, and I'm learning so much about the internal workings of things like typed data. This test is not very clean, but this is due to I'm currently sprinting at a local open source conference so there is a good chance I will be able to finally finish this today. Fingers crossed :) |
|
Alright that went pretty smooth! I think this is ready! @amitaibu care for a look? |
|
Yay! (Hectic days so might take a couple of days for me to have time to do proper review.) |
|
I saw two |
This is a continuation of amitaibu#252. It is a simplified version of the initial implementation of OgContext that was created in that PR.