New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Gadget API-Do not echo stuff to wikipedia #251
Conversation
It appears that [15:36:43] Processing page ... is echoed in the GadgetAPI and that is bad
Codecov Report
@@ Coverage Diff @@
## development #251 +/- ##
=================================================
- Coverage 73.52% 73.47% -0.05%
+ Complexity 1236 1234 -2
=================================================
Files 8 8
Lines 2338 2334 -4
=================================================
- Hits 1719 1715 -4
Misses 619 619
Continue to review full report at Codecov.
|
This brings to my attention the lack of any test cases for |
I do not think that this is straight forward. We would need to:
|
tests/phpunit/TemplateTest.php
Outdated
@@ -564,6 +564,30 @@ public function testConvertJournalToBook() { | |||
$this->assertEquals('cite book', $expanded->wikiname()); | |||
} | |||
|
|||
public function testGadgetAPI() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we need to test, if anything, is that nothing is echoed when gadgetapi.php is run (except the final output). As you say, the functionality itself is tested in TemplateTest.php and elsewhere. It's not clear that this tests that.
Honestly, all we are checking is that the json encoder in PHP works. If PHP is that broken, then nothing is trustworthy, including our tests.
Codecov Report
@@ Coverage Diff @@
## development #251 +/- ##
================================================
- Coverage 73.52% 73.5% -0.03%
+ Complexity 1236 1235 -1
================================================
Files 8 8
Lines 2338 2336 -2
================================================
- Hits 1719 1717 -2
Misses 619 619
Continue to review full report at Codecov.
|
Fixes Gadget API.
Bot sends this when processes page with simply "MyText":
[15:36:43] Processing page ...
{"expandedtext":"MyText","editsummary":"/* Testing */ | [[WP:UCB|Assisted by Citation bot]]"}
Leads to error on wiki side because of processing page line is not valid json:
SyntaxError: JSON.parse: expected ',' or ']' after array element at line 2 column 4 of the JSON data
I was confused about cause. Turns out that HTML had nothing to do with it.
This turns on the eating of the buffer sooner.