Commit graph

295 commits

Author SHA1 Message Date
jenkins-bot a58d9c39d3 Merge "Various code cleanups, more compact syntax and such" 2022-11-29 10:21:02 +00:00
Moritz Schubotz (physikerwelt) 7ecce2a104
Skip tests that are known to fail
* don't return on skipped tests
* add some additional non math test cases

Change-Id: Ia389141693a2e2ed6dea4294549674402e109d64
2022-11-27 15:08:56 +01:00
Thiemo Kreuz 7dbc300a5f Various code cleanups, more compact syntax and such
Some notes:
* Note that array_column() strips array keys. I checked and this is
  fine here.
* Html::element() will skip attributes that are set to null or false.
  Perfect fit here.
* I routinely remove comments that do notjing but repeat what the
  code already says.

Change-Id: Ie7797b78f1af5d8404c9e97b333fac8c6b3ac85e
2022-11-23 15:36:22 +01:00
Moritz Schubotz (physikerwelt) b3e57cbfc2 Make code using the Math.CheckerFactory service discoverable
Otherwise IDEs and other tools don't know what's going on.
...->getService() returns mixed.

Change-Id: If0429485941c19eb0e88896cb1ada66a5320bafe
2022-11-23 12:10:32 +00:00
jenkins-bot e0f6e21ac7 Merge "Remove PNG rendering mode" 2022-11-22 19:07:20 +00:00
thiemowmde 67906845ff Make use of ?: and ?? shortcut syntax where it makes sense
I hope this makes the code more readable.

Change-Id: Ie458551d26cd8c8cd6e1cc18789d93176230f0d4
2022-11-22 12:29:44 +01:00
Moritz Schubotz (physikerwelt) 110656335f Remove PNG rendering mode
Removes functionality to
* select PNG rendering mode
* automated fallback to PNG images for SVG rendering
* PNG mode related class and tests

However, PNG images received from mathoid / restbase are still stored.

Bug: T311620
Change-Id: I595926027433182cc0396570bc3f1ce0cd2cafb3
2022-11-21 18:57:27 +00:00
jenkins-bot 4b6137bed4 Merge "Avoid try…catch where if…else will do when using LanguageFactory" 2022-11-21 08:57:13 +00:00
Bartosz Dziewoński 1b7a46ff4f Avoid try…catch where if…else will do when using LanguageFactory
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.

I truly feel mocked after working with this code. See if you can find
the two lines in this diff where the meaningful changes are.

Change-Id: Ifcb31dbb7113ce57526f06558cde2abedee317d7
2022-11-18 21:08:24 +01:00
Reedy 6081e9b01a DeclhTest: Fix string interpolation
Bug: T314096
Change-Id: I1c2a11c1481ca7d8e91e9c0468600ace9038e333
2022-11-04 18:08:02 -06:00
jenkins-bot 3dcdbbd95b Merge "Fix Perfomance Issues of TexUtil" 2022-10-25 18:10:09 +00:00
jenkins-bot ded8f70772 Merge "Activate chem and inline-tex type input in LocalChecker" 2022-10-25 17:50:31 +00:00
Stegmujo b5d3bca4b4 Fix Perfomance Issues of TexUtil
TexUtil gets instanciated and loads a json for each node in Literal and Fun1. This is not necessary since it takes much RAM and time to load the corresponding JSON from files.

Bug: T321599

Change-Id: I91855ebc4437f075302ae13d367ca4902cc0f3ba
2022-10-25 17:44:02 +00:00
Stegmujo c74ced3716
Activate chem and inline-tex type input in LocalChecker
Bug: T321262

Change-Id: Ib8e55290cc77cdc07274e7f1dbd27d20db0f3227
2022-10-25 18:35:54 +02:00
Stegmujo d2bd2f4554
Add Tests and Downloader for Chem Input Types
Bug: T321262

Change-Id: I4e0af8ab0eaa02829dffb7ff5fccc4564ed5c1ba
2022-10-25 16:55:58 +02:00
Stegmujo caf3a1e26b
Add All Wikipedia Tests and Fixes
These tests are skipped in CI, but are ran locally.
Contains also preliminary fixes to make the assertions not crash
locally and a shellscript for downloading the json-file with tests locally.

Bug: T315223

Change-Id: If5da7e2a29d9179eabecbb4707ed244f5d445d39
2022-10-25 15:32:53 +02:00
Stegmujo c27f7edef9 Add Integration for the TexVC-PHP check to Math
Bug: T312528

Change-Id: I0eda7d4213a5f703ab7ae7887aa364af9e576dbe
2022-10-20 16:39:19 +00:00
Stegmujo 8333e2541a Create Tests for Parser and TexVC
Parser.php is excluded from linting steps.

Bug: T312528

Change-Id: I372832bb9ea212f9bc06947d0ef192f270dc54c2
2022-10-19 17:25:20 +00:00
Stegmujo ba47c32e1d
Add Node and Util fixes for Parser.php
For development history of this changeset see:
Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb

Bug: T312528

Change-Id: I61cfdbd63f8d50b072ada05927a134686fdd53d3
2022-10-19 16:33:15 +02:00
Stegmujo 2ae8f50348
Add final nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I01b99430d510c0df452d1faba340e2595ae50a33
2022-09-06 14:42:37 +02:00
Stegmujo d940161a3e
Add further nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I8bd30bc45d2c23214b317ca0c04aa8e7d6a2da33
2022-09-02 19:34:07 +02:00
jenkins-bot bfcb547e63 Merge "Minor: MathDatabaseTest cleaning" 2022-08-26 17:15:36 +00:00
jenkins-bot 008f6a6739 Merge "Add some basic nodes and texUtil" 2022-08-26 17:06:28 +00:00
jenkins-bot 1d3bbf8fe7 Merge "tests: Skip schema test for sqlite/postgres" 2022-08-26 16:45:54 +00:00
Moritz Schubotz (physikerwelt) 7cae2517e5
Minor: MathDatabaseTest cleaning
* Remove unused constants
* Refactor deprecated wfGetDB

Change-Id: I926fbe59fd2fef9617da9870b8b9c2a6662f22df
2022-08-26 18:23:50 +02:00
Stegmujo 6be5724740 Add some basic nodes and texUtil
Texutil related functionalities and tests will come in other changeset.
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: Iead338a31403348603442b43ae802270f6b1d675
2022-08-26 15:41:38 +00:00
Stegmujo 4901388cfc
Add TexNode
This is corresponding to 6c6988c4f6/lib/nodes/texnode.js

Bug: T312528
Change-Id: Idfd6826e6d15c0e70848e879dd23fc5e4cf113b5
2022-08-23 08:43:01 +02:00
AndreG-P 951dec1fab
REST API endpoint for popups
Implement a rest API endpoint that displays the popup that is currently
only shown on a special page.

Code was revived from Idd22057a88312bf1a1cb5546d0a6edca5678d80d

Bug: T288076
Bug: T233099
Change-Id: I65fcbf25ac5818f6c649daf494c719921247e8f5
2022-08-05 17:47:44 +09:00
AndreG-P 14c4df1336
Support new properties 'Symbol Represents' and 'In Defining Formula'
Add support for the new properties 'P9758' (symbol represents) and
'P2534' (in defining formula) for the special page that shows
in depth information about tagged formulae.

Bug: T312893
Change-Id: I39551e04487f77cca60c89e8c95293032fd5bd6a
2022-07-27 22:30:54 +09:00
Moritz Schubotz (physikerwelt) 480d241f97
Make dependency to Wikibase client config optional
The MathEntitySelector gets its config from wbRepo which caused a hard
dependency on the Wikibase client.
If the Wikibase client config is not available a default value (wikidata)
is used to determine the URL of the foreign repo.
As the dropdown will never do write operations, we restrict the repo
access to anonymous read only.

Bug: T313143
Change-Id: Iba33dfd32a78f4ad7c2e99a1f56218458ab884b4
2022-07-25 09:51:47 +02:00
jenkins-bot 12ca486684 Merge "Replace MathWikibaseConfig with ServiceOptions" 2022-07-25 07:10:18 +00:00
jenkins-bot 53a2ea9909 Merge "Provide static Factory Class for Math related services" 2022-07-25 05:52:32 +00:00
Moritz Schubotz (physikerwelt) 882c49599b
Replace MathWikibaseConfig with ServiceOptions
MathWikibaseConfig introduced additional complexity by passing through
some services to MathWikibaseConnector.
The remaining options were just a list of properties that could also be defined as ServiceOptions.

Bug: T313646
Change-Id: Ib9083c0cb62f6d972befc7f5dc3ed47f55cf92a5
2022-07-23 11:37:30 +02:00
Moritz Schubotz (physikerwelt) 73c41b4626
Provide static Factory Class for Math related services
Initially we provide one service. More services will come in
the future.

Change-Id: I98a0f5f181f729e123a063dabf3597b5effa55b8
2022-07-22 18:59:11 +02:00
Moritz Schubotz (physikerwelt) 0bec9dc904 Remove deprecated method hasSite
The method always returns true and has no obvious benefit.

Change-Id: I77727d37c16e6234cf13e0ccf5d8fe94142ddd2a
2022-07-22 12:51:21 +00:00
Moritz Schubotz (physikerwelt) a274beae78
Transform MathWikibaseConfig into a service
* add some basic tests
* migrate MathWikibaseConnectorTest to a unit test

Bug: T313331
Depends-On: Ic3b8d4f685d5cf648a02696284b6ee499502a12a
Change-Id: I38d6425eb5e2c52ae4362c4b8656223a8d9d90a5
2022-07-21 15:22:47 +02:00
Moritz Schubotz (physikerwelt) a8052d564b
Transform MathWikibaseConnector into a service
* add some basic tests
* MathWikibaseConfig should also be transformed into a service in a follow
up to allow for better testing

Bug: T313331
Change-Id: Iec7446a06d9a117cdeba9d26616f4fdf8e8540ca
2022-07-21 08:34:25 +02:00
Umherirrender e176ed68c3 tests: Skip schema test for sqlite/postgres
Running the updater twice (in test setup and in tests) confused posgres
-> Error 42P07: ERROR:  relation "mathoid" already exists

Change-Id: I1113888a38a49ee79b94d83c305eb99baa75f802
2022-07-19 21:06:45 +02:00
Stegmujo c60565c790 Remove some unused methods.
Bug: T310350
Change-Id: I0629b9a963bf57b1368ffc61f7c3b631b19f5260
2022-06-27 18:20:06 +00:00
russ-rogovetz 894c22989b
Replace getNativeData to getText for Math
Replace Content::getNativeData() calls with TextContent::getText() in Math extension.

Bug: T283679
Change-Id: Iaf3b7f82f14069374de8ede7b519d822f8d6010f
2022-05-30 21:04:39 +02:00
osamaahmed17 099e327cc6 selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests have been changed to async.

Update npm packages: @wdio/*, wdio-mediawiki and webdriverio because async mode needs at least webdriverio v7.9.

Remove npm package: @wdio/sync.

Bug: T293076
Change-Id: I35b3b29c09e80306d14a12c5194efeead22a9804
2022-02-01 01:24:19 +11:00
Umherirrender e2e4f1cb6b Use ParserOptions::newFromAnon instead of ParserOptions::newCanonical
ParserOptions::newCanonical is deprecated.

Change-Id: I8e709cd4e1b2dbf86f10176a3bbc5854d463ede0
2021-12-18 20:10:48 +01:00
Alexander Vorwerk ee2867db2d MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: Icef9bbb1c515b775ccdcf6bc692c8c2cab4ae503
2021-10-12 00:51:10 +02:00
Reedy df89742072 Remove global namespace class aliases
Depends-On: I7e8e7f5ec0ac2f995489a559e88fc55ab877e06e
Change-Id: Ie3f5d5880363777eda4608fe8753a69e7ff3c5f9
2021-10-01 16:30:09 +00:00
Petr Pchelko cfc2f4f319 Register 'math' parser option
Instead of modifying a page rendering hash,
use the proper mechanism of parser option
registration. The cache is still split on parser
option value. The 'math' option is lazy, since
not all pages contain 'math' tag and we want to
avoid an user preference lookup for every parse.

WARNING: this will invalidate ParserCache for
all pages that contain <math> tags, but according
to Moritz, this is about 1% of all pages, so we
should be fine.

Setting up the test is still rather hard and weird
due to very hacky rendering mode to user option
converter, and math renderer interaction with the DB.
This will be cleaned up later.

Depends-On: I92b3e18fabef4eecac2ec2a4844f1be2716e5d89
Change-Id: I3bce04684070ad306685dabbc51267def25773cd
2021-09-30 06:55:54 -07:00
Petr Pchelko b458303fed Move rendering modes name resolution to MathConfig
Change-Id: Ie1926f1da02f6ab585d3efbc71abe1716dac66e5
2021-09-30 06:29:36 -07:00
Petr Pchelko a3306b24df Clean up handling of user preferences
Change-Id: I3e8f0a0be16d92a411de796b8e25df3a7760099f
2021-09-29 10:28:03 -07:00
Petr Pchelko 9b7205599c Move math configuration methods into a service
This is doing a bulk of the job of creating a service
for working with math modes configuration. There's
still things to do, like moving math mode names,
and perhaps depending on default user options to
provide a bit more convenience, but that will be the
next step.

Change-Id: I1259a93651920f44104f2f5135e3e620c858be8d
2021-09-28 13:31:08 -07:00
Jakob Warkotsch 950b150e8c FP: Change PropertyId to NumericPropertyId
See ADR 22 for more info.

Bug: T289125
Change-Id: Id6293612a102d2785f5fee984af431e1219b64c0
2021-09-17 10:47:14 +02:00
Petr Pchelko 551340ee11 Skip wikibase tests if wikibase is not loaded
When running tests locally I don't want to install wikibase
if I'm not working on wikibase-math integration. It's
annoying that some of the tests fail in this schenario.

Depends-On: Id996abdb353547b95d795494ba961b9a215ef2ef
Change-Id: I836c7a3bab5393b7482e985d9148226373ae0a58
2021-08-13 18:43:42 +00:00
Petr Pchelko da8e918fb3 Enable most tests which were previously disabled
Additionally - remove RestbaseInterface::checkBackend.
When HTTP requests are banned from unit tests this method
makes no sence.

MathoidCli tests were not reenabled cause it's a bit hard
to mock shell acceess. Hopefully as part of Shellbox
transition we can have MockShell trait in core and reenable
those tests

Bug: T265628
Depends-On: I350ed59af603a0504704af3265787a4be8f2dc2a
Change-Id: I294d0ed905193850dc38cb3071eb9b31c8863121
2021-08-12 08:57:58 -07:00
Petr Pchelko 0cd6acd3f7 First pass at cleaning up error handling
The overall aim is to make renderer and checker
proper services and stop storing each operation
state in them. This patch reduces the number of
places where we store the lastError. I've decided
to stop here in the first pass so that the patch
doesn't grow out of proportion.

Change-Id: Ice7e1f9f2f074d62ef1819355a510ce0b0335d88
2021-08-11 06:05:33 -07:00
Petr Pchelko 404315973e MathLateXML: override getPostData
Instead of having a separate method for getting the post data
in MathLateXML, we can just override getPostData method from
parent and make the makeRequest method signature much simpler.

Change-Id: I07b683856885396ff7b6b5a40df79399828c8214
2021-08-10 12:12:53 -07:00
Petr Pchelko 44ad3fbdf9 MathMathML::batchEvaluate - only pass MathRenderer
We do not need a ParserObject in the batchEvaluate,
so only pass in the MathRenderer

Change-Id: Id2e8cad709c08a0225597cb1fbf85289830f828b
2021-08-05 07:09:59 +00:00
Petr Pchelko ddff31bb0d Remove deprecated feature to declare multiple mathoid hosts
This is not the job of an extension to be a load balancer.
This feature was already deprecated and is not used in WMF prod.

Change-Id: I950dbaf45bc40d9d9ed61b1c98b339d3d38326fc
2021-08-03 09:21:43 -07:00
Petr Pchelko 45090ad369 Make use of MockHttpTrait instead of custom mechanism
Depends-On: I4c3aab6ab88695729b4f398dacf3575fbdb4dad4
Change-Id: I60b192c9b9c2ae434fb3f9aff8c460e0fc0806b1
2021-08-02 13:46:44 -07:00
Petr Pchelko e6507e95d7 Create Math.RendererFactory service
Change-Id: I474d746bae81ddf4322814c45141c981ecdb077b
2021-08-02 11:57:57 -07:00
sahil e371e23dc1 selenium: Update wdio-mediawiki
wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Bug: T283597
Change-Id: Id488159c2a5b12d1b44a7037fa3038a2a541b2f1
2021-07-28 16:43:40 +05:30
vladshapik a024908d5f Avoid using deprecated Parser::getUser
Bug: T287168
Change-Id: If3443b879ee01c3cbdbf94d1a690bd9c3bf182b1
2021-07-27 17:50:25 +03:00
libraryupgrader b409746fc6 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* ws: 7.3.0 → 7.5.3
  * https://npmjs.com/advisories/1748 (CVE-2021-32640)
* glob-parent: 5.1.1 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)
* normalize-url: 4.5.0 → 4.5.1
  * https://npmjs.com/advisories/1755 (CVE-2021-33502)

Change-Id: Ie14979780cdbd04fa2804f5317e8b0f6b0029470
2021-07-23 02:28:22 +00:00
jenkins-bot cdc2fc89c8 Merge "Remove wgMathUseRestBase" 2021-05-15 17:17:44 +00:00
jenkins-bot fb4cd8e6ad Merge "Selenium: update README.md file" 2021-05-14 19:44:09 +00:00
physikerwelt (Moritz Schubotz) d25dc0fb79 Remove wgMathUseRestBase
Bug: T274436
Change-Id: I0c0311130516646833ef862e047c8f540f40c92a
2021-05-14 14:39:25 +02:00
sahil b43acdd0d0 Selenium: update README.md file
Bug: T210726
Change-Id: I99d32dee1d8b8d2949b475abb94d4b3705e1fda6
2021-05-07 17:39:17 +05:30
libraryupgrader c416046515 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Iccba9c52c8390b00fe1cc31e5f3bed3074e27f85
2021-05-05 06:48:02 +00:00
Željko Filipin 5c37603c23 selenium: Add JUnit reporter
JUnit reporter is required to create the XML file that Jenkins uses to
create Test Result Trend chart for selenium-daily-beta-Math
job.

Bug: T214686
Change-Id: Ic2373f3b89946cf191cfcb1dd9ed99608deb660c
2021-04-29 15:56:42 +02:00
Reedy b0f07ee605 Namespace extension
Change-Id: I7ba90b35e5b6f6e4c296079fc524667ea41c0980
2021-04-08 01:17:14 +01:00
Moritz Schubotz (physikerwelt) 35d57a65cc Use Mathoid to validate Wikibase formuale
* Reenable math validator tests
* Introduce $wgMathUseRestBase which defaults to true
  and determines if mathoid is used via RESTbase or directly
* The effect of this change can be tested by setting $wgMathUseRestBase
  to false, and then creating a new statement of a property with type math.
  One should see a connection to mathoid for every new string and one should
  also see the WAN cache for the check endpoint to fill up. Note that
  setting WANObject cache to the database simplifies the investigation
  of the WAN cache content.

Bug: T274436
Change-Id: I40109e9e09464da78bf855646fb800ee87c1ea67
2021-02-18 22:13:58 +01:00
Moritz Schubotz (physikerwelt) 7780424504 Extend mathoids Checker functionality
* Keep status code and response in memory
* Allow external cache preloading.
  This will be required for the one-stop mathoid batch rendering
* Duplicate functionality from the restBASE interface
** Error rendering
** Validity checks
** getter for validated tex

Depends-On: Ic779e671ada0d0306e0935e578b47c431abd520e
Change-Id: I066975b9ba03f5861f6c92687cba4743044ea82a
2021-02-09 23:36:03 +01:00
libraryupgrader 79a7324eed build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 34.0.0 → 35.0.0
  The following sniffs are failing and were disabled:
  * MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
  * MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
  * MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic
  * MediaWiki.Commenting.PropertyDocumentation.WrongStyle

* mediawiki/minus-x: 1.1.0 → 1.1.1

npm:
* eslint-config-wikimedia: 0.17.0 → 0.18.1
  The following rules are failing and were disabled:
  * no-useless-escape

Additional changes:
* Added the "composer phan" command to conveniently run phan.

Change-Id: I1c641a4945f94337ca22763920601400ee9ab691
2021-02-06 12:19:19 +00:00
Moritz Schubotz (physikerwelt) 2e0276c7f9 Remove mathoids coverage test
Before the HTTP tests were blocked T265628, the Math extension did
test all examples from w:Help:TeX and additional regression test
against the configured mathoid/restbase instance. Effectively, those
tests did only verify the hashes returned from mathoid/restbase.
We now drop this kind of integration test.

Bug: T265646

Change-Id: Iffe5105457297fdc2222af9f11ff56e78c479f32
2021-02-02 19:16:21 +00:00
Umherirrender bcaab9cbf6 Improve function and property documentation
Change-Id: Ic809107bbce3d9019e0c9239281635a738ccdc36
2021-01-23 01:46:48 +01:00
Moritz Schubotz (physikerwelt) 31aa824cc9 Remove RESTbase check compatibility endpoint
Change-Id: I8c539e96519e0f23ed606403ed88370edde70764
2020-11-24 19:24:41 +01:00
Clara Andrew-Wani d1315079f2 Update api-testing package and test to use updated methods
Change-Id: I95f3fe36d41c71ddb4fb928a3b1878fb88fc9458
2020-11-05 16:53:18 -05:00
James D. Forrester 0c6104811c MathCoverageTest: Skip all tests for now as HTTP requests are banned
Bug: T265628
Change-Id: Iaa1ccb50475785061d9da1ff3e7219b38cee145d
2020-10-27 21:48:28 +01:00
Umherirrender c4cf84fdad Fix mathoid test data for last changes to renderer
After deployment of changes for T207535 the test data does not match
longer the expected output and fails

Change-Id: I7bb83ef007a0896ae0b3673bef5c344c41c4d5a6
2020-09-19 20:18:03 +02:00
DannyS712 b3252601a3 Remove unused non-global $wgUser in wfTest
Bug: T248550
Change-Id: I994bd6158012461efbb238c7a869fa8e642bca96
2020-09-11 18:34:23 +00:00
Ed Sanders e489beac5b build: Update eslint-config-wikimedia to 0.16.1
Change-Id: I9c2de727e1a4c7657ccca4dd22a175bfad06a852
2020-06-16 15:59:33 +01:00
DannyS712 4c4e02a7a9 Remove unneeded ::setUp and ::tearDown methods that only call parent
Change-Id: I3877917e9b23ce0e064ca751e415d9f1b84e1a8c
2020-06-07 03:09:08 +00:00
Reedy 2c220ddabc Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I816b6d26471527137cbddd313cd432f0a37db891
2020-06-05 00:17:18 +00:00
vidhi-mody cbd3fdbdcc Selenium: Update to WebdriverIO v5
Update NPM packages: webdriverio, wdio-mediawiki.
Update ESlint configuration.

Replace NPM packages:
- wdio-mocha-framework with @wdio/mocha-framework.
- wdio-spec-reporter with @wdio/spec-reporter.

New NPM packages: @wdio/cli, @wdio/local-runner, @wdio/sync.

Replace:
- `browser.element` with `$`.
- `chromeOptions` with `'goog:chromeOptions'`.
- `password` with `mwPwd`.
- `username` with `mwUser`.

Bug: T253791
Change-Id: Ief27154b2e10621b4dce51c634a075cd381021f8
2020-06-03 01:03:56 +05:30
Moritz Schubotz (physikerwelt) 7c41bc19f8 Add mathoid check endpoint to REST API
Expose the math checking service via the REST API.

Port the behaviour of the RESTbase check endpoint to a new endpoint
that uses the MediaWiki API.

* this endpoint does not (yet) provide actual rendering (only checking)
* consequently it does not supply the x-resource-location header

Bug: T252390
Change-Id: I28bcb9a925953062b43cd3481536784431edcd8a
2020-06-01 12:11:24 -07:00
Moritz Schubotz (physikerwelt) 707ad58598 Add MathCheckerFactory Service
Use WANObjectCache rather than genuine DB tables for greater
flexibility.

Note, this commit is the second step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214

Bug: T252390
Change-Id: Ifa7d943875f05088ef697a5a18ad292342a9b4ad
2020-05-27 07:29:49 +02:00
Moritz Schubotz (physikerwelt) fc0faf18c3 Move checking code to a new namespace
Introduce new namespace \MediaWiki\Extension\Math\ and move checking
code to this new namespace.

Note, this commit is the first step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214

Bug: T252390, T187154
Change-Id: I8c93f4b21d4a72ef2d52d4774d69e4ef55d037ec
2020-05-12 21:26:45 +02:00
Umherirrender e599afa6db Use assertStringContainsString in unit tests
Using assertContains() with string haystacks is deprecated and will not
be supported in PHPUnit 9. Refactor your test to use
assertStringContainsString() or assertStringContainsStringIgnoringCase()
instead.

Change-Id: Ic35f3c60a7f49dfe244b87192d7f161c117b37e1
2020-04-05 13:46:04 +02:00
C. Scott Ananian 6a9299a2da Update to parserTests v2 (tidy by default)
Bug: T174199
Change-Id: I5e6bb7fa3c36023ba70a24dfef8ea409aad55453
2020-04-02 14:19:46 -04:00
Thiemo Kreuz a429c8cc35 Fix escaping issues and a series of unrelated code cleanups
Actual changes:
* Let the special page accept the subpage parameter, e.g.
  [[Special:MathWikibase/Q6203]].
* Fix some of the message escaping issues in SpecialMathWikibase.
  Messages that are just plain text and not supposed to contain any
  parameters, wikitext, HTML, or something like this should be
  properly escaped, either via Html::rawElement( $msg->escaped() ) or
  better Html::element( $msg->plain ). The later approach is cheaper.

Other code cleanups that don't affect production:
* Reduce the amount of duplicate code in SpecialMathWikibase.
* Make use of the preg_match() return value.
* Remove default parameters from parent::__construct() call.
* Remove some auto-generated comments.
* Remove some comments that don't add new information, but just repeat
  what the code already says.
* Make use of PHPUnit's assertCount().

We can split this patch into smaller patches, if you prefer. This
should especially be done if one of the changes is controversial, to
not block the other changes. Please tell me.

Change-Id: I8c20014435af3d2ac9c7381fe5fd00b9fe49b2c2
2020-03-21 14:53:15 +00:00
Daimona Eaytoy 10aee4e9a5 Avoid using Title::__construct
Change-Id: I4241487d77a9528ca06251ab25e2d2b08401d893
2020-03-08 10:33:17 +00:00
DannyS712 7d38b11af5 Use ParserOptions::newFromAnon() instead of relying on global $wgUser
Bug: T246861
Change-Id: I42c813a72a2ecacbdc96777d1a94485ac890fba0
2020-03-07 02:19:08 +00:00
peter-ovchyn 90b26c0878 parser: Replace 'new Parser' in favour of using ParserFactory/MediaWikiServices
Bug: T244055
Change-Id: I4049f155d066b165f0d5ec634da54b0bfed89188
2020-02-18 12:55:14 +02:00
Umherirrender e4b8834d39 Fix case of MathDatabaseTest::setUp
Change-Id: Iabb83ef681bb824df3d47c6bd60f769a50f4da45
2020-01-28 21:18:17 +01:00
jenkins-bot 3f0b69601b Merge "Stop using deprecated assertType" 2020-01-20 11:06:33 +00:00
Reedy d819311602 Add $snakNamespace parameter to ValueSnakRdfBuilder implementer
Bug: T243122
Change-Id: I9b7c3b9daa81069a5b5eb66271f2c732cefe313f
2020-01-18 14:06:43 +00:00
Daimona Eaytoy 9d6c43c728 Stop using deprecated assertType
Change-Id: I675132ced8187c3c5d06e0c94447e5e235aa231c
2020-01-17 16:15:37 +00:00
libraryupgrader 5018e51b29 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate

Change-Id: I57bb0f5bc4167ea4b4a50d666ad95c02fcc7d8c9
2020-01-14 22:01:54 +00:00
Umherirrender 0be18dc97d Move test helper classes into own class file
Also fix the name of one test file to match the file name

Change-Id: If622e925645cf21bf726f4db0f779182d78bbd73
2019-12-06 21:47:52 +01:00
Thiemo Kreuz 852eba3c9e Always call original constructors in tests, and more cleanups
* Get rid of a few more MockBuilders and mocks that aren't needed.
* Make sure the original constructor is always called. This is highly
  relevant for I263a711.
* Fix mixed order in assertions. In PHP, the expected value comes first.
* Add some missing inline @var type hints.

Change-Id: Ia15d62af56dfdb61bc2514aa994ce3d4ecd6e077
2019-11-26 14:42:37 +01:00
jenkins-bot 6fe2051f6b Merge "Update tests to not use MockBuilders, if not needed" 2019-11-26 11:34:45 +00:00
Thiemo Kreuz 61b9904bec Update tests to not use MockBuilders, if not needed
* Replace MockBuilders with straight constructor calls, if possible.
* Use TestingAccessWrapper instead of using reflection directly.
* Favor assertSame instead of the loose assertEquals. Note how this was
  actually hiding a bad assertion in one place.
* Remove some tiny pieces of dead code.

This was motivated by I263a711. I hope this patch here helps unblocking
the other.

Change-Id: I66efb818243a41aeed5fcd51fd520cd0d4acee4d
2019-11-26 11:21:49 +01:00
Thiemo Kreuz b189280467 Make all @covers tags absolute, and fix some
Some mentioned a "__constructor", which should be "__construct".

The leading backslash is not strictly needed by all tools. But some
need it. I learned it's best practice to always have it.

Change-Id: I22fe3a3b4828c02ab5a457aba9af5af1c72567ea
2019-11-26 11:01:23 +01:00