[TYPO3-core] RFC: #16134: TYPO3 doesn't always fix permissions for new files
Christian Kuhn
lolli at schwarzbu.ch
Tue Dec 7 01:46:13 CET 2010
Hey.
> You're right that adding tests whenever the functions are touched is a
> good policy, but with these tests the least significant part of these
> functions is tested and all the rest still remains untested.
> Atm. that's fine with me, but overall I find it a bit confusing that
> these kind of testing is considered to be useful ~ especially without
> beeing able to mock the fixPermission itself :/.
Yeah. Currently it's afaik impossible to mock a dependency of a static
class, especially if a method from the same class is 'system under
test'. This makes unit tests in our current case a bit longish ;).
And yes, the fixPermissions() call might be the least important, but
still: The tests make sure that this specific bug never pops up again.
Actually, they took me about one hour to get it (hopefully) right.
Personally I come to love unit tests: I *know* my code is correct after
I've written tests for it, and I *always* do something wrong in the
first place. Code, comments and code abstraction improve a lot the more
unit tests I write. For me, it's a lot of fun to feed code with edge
cases, it leads to more foolproof solutions. The fixPermissions() tests
and my pending scheduler cron command tests (#16611) are examples on how
I try to achieve that. And the best is: If something is wrong with the
code or the tests: The tests will show.
> Anyways I'm going to test it tomorrow - did you find/add any other
> places where the fixPermissions() was added?
I have #15133 on my radar but did not come up with a serious review yet.
Regards
Christian
More information about the TYPO3-team-core
mailing list