Skip to content

Conversation

splitbrain
Copy link
Collaborator

This picks up from #1985, drops the JSON parsing again (sorry) and relaxes the options a bit more. They are now separated by spaces and the quotes are optional.

To make testing easier I merged another branch of mine into this which allows for easy testing of private or protected methods. This way I was able to test the option parser directly.

I also applied the code change from GeSHi/geshi-1.0#104 manually.

lpaulsen93 and others added 5 commits May 23, 2017 20:33
While it's generally frowned upon testing privates, it can often be
useful and the easier way to write tests. Eg you want to test something
complicated method that is important, but you do not want to expose it
directly to other classes...

This new method uses reflection to make access to such methods possible
from within tests without the need for intermediate classes.
* private_testing: (375 commits)
  make testing of inaccessible methods easier
  updated composer dependencies
  renamed ActionRouter::checkPermissions to checkPreconditions
  shortened new search configs
  Section edit: corrected pattern 'SEC_EDIT_PATTERN'
  fix regex character class. fixes #2301
  fix: switch extensions if stylesheet in style.ini doesn't exist
  refactor: rename and move function to set $JSINFO
  typo. capital P for class name
  fix: add missing global $ACT for $JSINFO
  refactor: use native json_encode for $JSINFO
  refactor: rename JSINFO.DOKU_UHN and JSINFO.DOKU_UHC
  refactor: extract $JSINFO initialization into tpl_ function
  refactor: rename dta and dtb parameters
  doc(search): parameter must be string or false
  doc(search): highlight is expected to be an array
  show adavanced tools with JavaScript only
  adjusted language files to remove outdated string
  removed sub header from all languages
  added aria attributes
  ...
Quotes are now optional, the options are spearated by space
@splitbrain splitbrain added this to the 🐱 Greebo milestone Apr 13, 2018
Copy link
Collaborator

@lpaulsen93 lpaulsen93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGBI. Just an question open.

* @throws ReflectionException
*/
public function testOptionParser($input, $expect) {
$h = new Doku_Handler();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever executed? I assume there is some magic happening because of the @dataProvider dataProvider comment?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is magic :).

PHPUnit calls this function with every element in the array returned by the dataprovider() method.

You can see it for yourself by running phpunit --filter TestOfDoku_Handler_ParseHighlightOptions on the commandline in the _test/ directory.

Documentation: https://phpunit.de/manual/6.5/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants