Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
locale.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Jun 2013 at 22:03 UTC
Updated:
22 Aug 2014 at 16:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
penyaskitoCreated a unittest (phpUnit) with the code above. Still using eval().
To run tests, change into the core directory and then run ./vendor/bin/phpunit --group Gettext.
Comment #2
dawehnerOOOH We should add this in other tests as well. That is cool!
It seems to be a perfect candidate for using dataProviders. Have a look at some "@dataProvider" tags in other core tests.
Comment #3
penyaskito@dawehner, Yes, I started this patch because I wanted to play with @dataprovider :_D
I'm curious if anywhere else we are using an external datasource like csv file, and if it would make sense here.
Pending tasks are:
Comment #4
penyaskitoAssign to me.
Comment #5
dawehnerAll our current data providers use just php directly.
Comment #6
penyaskitoAdded dataprovider method, this is fun stuff :-)
For avoiding eval and hardcoding expected values, we must return arrays with 199 elements.
How could we make that legible? No idea.
Comment #7
sutharsan commentedThere is no need to get all 199 values. You can either only test the retured values or use the default as in locale_get_plural().
and/or you can call each function with a number of random values.
Comment #8
penyaskitoChatted about this with chx and dawehner, and I didn't fully understand this, now I think I do.
This patch adds really long lines for the expected array, but I think in this case is acceptable.
This makes 265 assertions instead of 2400.
Comment #9
penyaskitoImproved docblocks per chx suggestion.
Comment #10
penyaskitoTagging.
Comment #11
gábor hojtsyAdd tag.
Comment #12
dawehnerI really like the new approach!
The first description should just be one line, try to truncate it to below 80 chars.
After that the coding style forces you to make an emptyu line.
Comment #13
dawehner.
Comment #14
penyaskitoUnassigning and tagging with novice, only #12 is pending and I cannot find the time at the moment.
Comment #15
duaelfrComment #16
dawehnerThis is nearly perfect.
Let's put an empty line here between.
Comment #17
gábor hojtsyComment #18
penyaskitoI found some other missing blank lines according to our standards. Also corrected one function comment to a single line.
Comment #19
dawehnerThere is wrong indentation in quite some docs (sorry I can't use dreditor at the moment).
Comment #20
mile23I found that #18 applies cleanly, but then has one error and fails all the tests. This is with PHP 5.3.14 and 5.4.4.
I get this error:
I'd guess that arises out of line 46:
$result = isset($new_plural[$number]) ? $new_plural[$number] : $new_plural['default'];Comment #21
mile23Hmm. Tag craziness.
Comment #22
gábor hojtsy#18: plurals-test-2031441-18.patch queued for re-testing.
Comment #23
penyaskitoThis fails because depends on #1273968: remove eval from locale.module which was reverted because of the js issue.
Comment #24
gábor hojtsyRemove from sprint, since that one is not on sprint either. Let's focus on our several outstanding major and critical tasks!
Comment #25
yesct commentedtag was stuck. trying again to remove sprint tag.
Comment #27
penyaskitoRetesting #18, as the blocker issue was fixed.
Comment #28
penyaskitoComment #29
penyaskitoThere are not novice tasks here anymore.
Comment #30
mile23Removed getInfo() as per: https://www.drupal.org/node/2301125
A ton of coding standards reformatting.
Renamed dataprovider to providerTestPluralsFormula().
Comment #31
gábor hojtsyYay thanks! It is always sad to see patches in limbo for code style but then again we like looking at code we can discern :D
Comment #32
alexpottCommitted e665794 and pushed to 8.x. Thanks!
Comment #33
penyaskitoThanks!