54850[BUGFIX] Avoid reflection for public property injection
Commit message
Review
-
Code review CR +2
- Susi Moog +2
- Claus Due +1
- Wouter Wolters +1
- Christian Kuhn +1
-
Verified V +2
- Susi Moog +2
- Christian Kuhn +1
- TYPO3com +1 CI
Issues 1
Files 3
Review log 2832
Show 67 earlier messages
-
Alexander Schnitzler uploaded patch set 1 11/29/17, 10:11
-
Claus Due commented on patch set 1 CR +1 11/29/17, 10:15
So extremely easy that it kind of makes you wonder why nobody did this until now. -
Cedric Ziel commented on patch set 1 CR +1 11/29/17, 10:16
Great addition! -
Alexander Schnitzler commented on patch set 1 11/29/17, 10:17
I actually wonder why no one thought about it in the first place. ¯\_(ツ)_/¯ -
Claus Due commented on patch set 1 11/29/17, 10:17
This almost deserves a dedicated unit test, though. -
Claus Due commented on patch set 1 11/29/17, 10:18
Someone did think about this a long, long time ago. He just didn't make a patch for it like you did ;) -
TYPO3com voted on patch set 1 V +1 11/29/17, 10:21 Completed build in 09m 48s on Wed, 29 Nov, 11:21 AM Test Summary: 56856 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16910
-
Mathias Brodala commented on patch set 1 11/29/17, 10:24
> This almost deserves a dedicated unit test, though. How do you want to test this? You cannot check if a property assignment was done regularly or through reflection. -
Alexander Schnitzler commented on patch set 1 11/29/17, 10:26
I agree. This is not easy to test unless we pull out the code into a seperate method and check if that was called or not. Quite a hassle for a test. -
Benni Mack updated the commit message in patch set 2 11/29/17, 10:31
-
Benni Mack voted on patch set 2 CR +1 11/29/17, 10:31
-
Mathias Brodala voted on patch set 2 CR +1 11/29/17, 10:35
-
TYPO3com voted on patch set 2 V +1 11/29/17, 10:41 Completed build in 10m 02s on Wed, 29 Nov, 11:41 AM Test Summary: 56856 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16914
-
Andreas Kienast voted on patch set 2 CR +1 11/29/17, 10:52
-
Susi Moog voted on patch set 2 CR +1 11/29/17, 10:59
-
Claus Due commented on patch set 2 11/29/17, 11:06
> How do you want to test this? By mocking the "is public" decision so we also cover the "true" case. Currently, afaik, we do not have any fixtures or mocks that have a public injected property. Perhaps a prophecy can also be used to assert that Reflection does not get used in this case. But we should definitely ensure that the code at least gets executed in unit tests. This place in the infrastructure is, imho, mission critical. -
Susi Moog commented on patch set 2 V -1 11/29/17, 11:14
I'll try my hand at a test. -
Susi Moog uploaded patch set 3 11/29/17, 11:30
-
TYPO3com voted on patch set 3 V -1 11/29/17, 11:30 Completed build in 08s on Wed, 29 Nov, 12:30 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16925
-
Susi Moog commented on patch set 3 11/29/17, 11:36
(aside from the cgl stuff, need to figure out why the others are allowed to do multiple classes in fixtures:) this would be how I would test that, because we want to ensure the functionality works (and I'm not a fan of testing too much of inner workings). Both code branches are now covered. -
Christian Kuhn uploaded patch set 4 11/29/17, 12:17
-
TYPO3com voted on patch set 4 V +1 11/29/17, 12:28 Completed build in 10m 08s on Wed, 29 Nov, 01:28 PM Test Summary: 56868 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-16939
-
Mathias Brodala commented on patch set 4 11/29/17, 13:20
I'm not sure these tests are useful. They would work exactly the same without this change. -
Claus Due commented on patch set 4 CR +1 11/29/17, 13:51
> I'm not sure these tests are useful. They would work exactly the same without this change. I think they are. Although they don't test *how* the property was set, they test that it *was* set. In other words, the test tests the "public unit" of the code which is what it should be doing. Also, there truly is no practical difference from the outside if your property is protected or public. The only thing we do here is ensure that both of these internal code paths and both valid integrations get tested. Extreme nit-pick: I wouldn't call the getter and assert on return value; I'd use assertAttributeSame here. Just to avoid involving a second un-mocked method call being involved in the unit. -
Susi Moog commented on patch set 4 11/29/17, 13:59
@Mathias: yes, because we do want to ensure the functionality keeps on working. These tests basically say: you can use injection for public/protected properties - independent of how it's implemented. They ensure functionality, but DO NOT test implementation (which in my eyes is like it should be) -
Mathias Brodala commented on patch set 4 11/29/17, 14:14
> @Mathias: yes, because we do want to ensure the functionality keeps > on working. These tests basically say: you can use injection for > public/protected properties - independent of how it's implemented. > They ensure functionality, but DO NOT test implementation (which in > my eyes is like it should be) OK, so basically we have a functional test here, fine with me. :-) -
Christian Kuhn voted on patch set 4 CR +1 V +1 11/29/17, 16:47
-
Wouter Wolters voted on patch set 4 CR +1 11/29/17, 18:56
-
Susi Moog voted on patch set 4 CR +2 V +2 11/29/17, 19:12
-
Gerrit merged patch set 4 11/29/17, 19:12
-
Christian Kuhn commented on patch set 5 11/29/17, 19:30
not a straight backport. asked alex if he could help a bit. -
Alexander Schnitzler commented on patch set 5 11/29/17, 19:47
Due to the fact that we do not have the cached reflection data available in 8.7 like we do in master and due to the fact that most people do not use public properties for injection and thus hardly anyone will actually profit from this change, we decided to drop the backport. With version 9, we force people to use public property injection and then everybody will profit from this change.