Commit graph

295 commits

Author SHA1 Message Date
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
James D. Forrester 5096e35015 tests: Align return type with PHPUnit 8 requirements
Change-Id: I8c4c64c6e0cd107de10d23d8f564ea660fd86ada
2019-11-01 17:18:33 -07:00
Max Semenik abbe5a3714 tests: @expectedException is deprecated
Bug: T234597
Change-Id: Ib694f60dabc9a8ac94fb10ed187892af8f36377e
2019-10-15 19:45:27 -07:00
James D. Forrester 6e8ca25d46 build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: I620a56f9edab3a751c7c41cd76ef401aac5d3b79
2019-10-11 10:45:11 -07:00
Ed Sanders 15352b3751 build: Update eslint-config-wikimedia
Change-Id: I0d650a842da003693275ecee565cf923dc2605d6
2019-10-04 15:38:36 +01:00
Ed Sanders 085ee7dcec build: Update linters
Change-Id: I0d6b323864a0e24f72ec6a823611927ea66ce025
2019-09-17 14:46:05 +01:00
Moritz Schubotz (physikerwelt) 0de63bdf6c Remove unused config variables from extension.json
Bug: T228547
Change-Id: I0aa7b624b645c3773b0d758634d370a494d1028a
2019-09-16 09:41:12 +00:00
Umherirrender a72741e313 Use Maintenance::addDescription
It is better to use a setter function than setting a property

Change-Id: I1df2d03cfaede53867daf9db8e26af5931c77ef9
2019-08-19 19:59:17 +02:00
libraryupgrader ccc6a0cb48 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 24.0.0 → 26.0.0

npm:
* set-value: 2.0.0 → 2.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* union-value: 1.0.0 → 1.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* mixin-deep: 1.3.1 → 1.3.2
  * https://npmjs.com/advisories/1013
  * CVE-2019-10746

Change-Id: Id7c540a37118f3a89917f467dcb715f504b843ef
2019-07-14 13:30:34 +00:00
Lucas Werkmeister 7abf09a4aa Update for namespace moves
Change-Id: I300aff6fa8e9f2ade8a97c826ef23ad56d40b392
Depends-On: Ie808d49aed00ec97117b04722456f24e96d49e68
2019-06-07 18:01:03 +02:00
Tpt d51e0ae06a Make error HTML valid XHTML
Allows easy parsing using XML tools

Change-Id: I27b5a8b719d703636c2c09d513cd04766fc66ce1
2019-04-24 12:06:14 +02:00
Umherirrender 328e2f2c3b Use ::class for class name resolution
Available since php5.5

Change-Id: Ib2a249e81f4039d015f12ebcce04326c847c7b13
2019-03-08 19:11:50 +00:00
libraryupgrader 54d1b77401 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I30daab715920757ec96350c9933fc18c887972c4
2019-02-06 23:08:22 +00:00
Ed Sanders 5f7f535c28 Update eslint-config-wikimedia to 0.9.0
Change-Id: I4c7dcb1b3cd3d03e3ea3d1e17bfcf63f3b553e50
2018-11-30 21:08:28 +00:00
Ed Sanders cf33c80b98 eslint: Use in all folders (including tests/selenium)
Change-Id: I0ab0a9f99817077934e7569d19d76735c33678e9
2018-11-12 17:08:22 +00:00
AndreG-P 2699479827 Link wikidata items to math tags
Adds a parameter that links individual formulae to their respective wikidata items.

Bug: T71424
Change-Id: I32cfe2039e62f163fe3aebaf77bafbdd84b343c6
2018-11-12 20:59:25 +09:00
jenkins-bot 817ada2cf1 Merge "Add tracking category for deprecated mhchem syntax" 2018-11-09 12:19:12 +00:00
Umherirrender d37698535a Add method scope visibility
Change-Id: I6b8e90017c9862fc082b216d44bebab34f3a6095
2018-11-02 18:52:06 +01:00
Moritz Schubotz (physikerwelt) a865a8565a
Add tracking category for deprecated mhchem syntax
Gets warning information from restbase and adds tracking categories
for deprecated chemical syntax.
Refactor mechanism to add tracking categories, and avoiding rechecking
already checked formulae.

Depends on: Ieca66f45ae7685d61eece1624bd7ff65ccad2eaa
Change-Id: I10e78ab79015dc1331f645c60b25bbbd237e23fe
2018-10-27 20:38:02 +02:00
Jakob Warkotsch b8153d0d24 Ensure database tests run as part of --group Database
The comments behind @group Database prevented the tests from being run
as part of the --group Database phpunit jobs.

Bug: T202223
Change-Id: I8dc68d3d90502fa7bd691cf18f0e296d97d3c893
2018-09-06 11:49:07 +00:00
Moritz Schubotz (physikerwelt) f0c8840148
Add math related styles and script via appropriate hook
Create MathDataUpdater class that checks if statements
are using math and adds the stlyes required for math in that case.

This patch has no effect until
I5bc0622ee7338f3215d14e15331a0a1931ca1ae0
is merged.

After both changes are in effect
I0abd6acbfa12fd503d11476f0c8c8c8a8a851cdc
can be merged.

Bug: T173949
Change-Id: I0e24bbb53e6e01d549f534744780ca1afc49fdd7
2018-07-24 16:40:52 +02:00
Thiemo Kreuz 97000ed8b0 Fix "@param $…" missing the type
Change-Id: I8d20ae852100a6ecc39df05eab3aa8e2b9c09480
2018-06-20 11:10:43 +02:00
Moritz Schubotz (physikerwelt) 9a04cd6de3
Improve test coverage for MathSource
Change-Id: I82d76db4b087b6472c2856806c70f4ef1ffbc8df
2018-06-08 16:25:11 +02:00
jenkins-bot ec99401072 Merge "Make use of the …::class feature whenever possible" 2018-06-06 12:24:31 +00:00
Moritz Schubotz (physikerwelt) e359eafe6c Improve tests coverage for MathPng
Change-Id: Ibb5138512afd20304983be44e0ab45a244634b4b
2018-06-06 10:30:53 +00:00
Thiemo Kreuz 5648b8e2c3 Make use of the …::class feature whenever possible
Note that a class is not resolved this was. …::class is not a function
call. It's more like a named string constant. Technically still a
string. The advantage is that IDEs and tools like linters can much easier
understand that these strings refer to a class, and list them in usage
reports, renames, and such.

Change-Id: I5225543dbb837685a1840837cb2772dd576cca38
2018-06-06 12:13:04 +02:00
Moritz Schubotz (physikerwelt) aa2c4cf913 Improve tests coverage for MathMathML
* deprecate and fix pickHost. It was broken and never used.
* simplify inputTypeSelection
* remove superfluous is_array check for the result of explode

Change-Id: I392f22f074facfe30b97d53a3002f464a471b67e
2018-06-01 15:36:35 +00:00
Moritz Schubotz (physikerwelt) c1c4e42c86 Improve tests coverage for MathFormatter
Change-Id: I2c9141753b59d99a1caf84279a0afcaf8431e631
2018-06-01 14:45:04 +00:00
Moritz Schubotz (physikerwelt) 4156f1c9b7
Remove dead texvc code from the math extension
In T74240 support for LaTeX based rendering of the <math/>-tags was
removed. This change eliminates the unused code from the repository.

Bug: T195871
Change-Id: Ic57d83fa49f090b574ce8b82fd2ebc84a5350318
2018-05-29 17:41:53 +02:00
Željko Filipin 88e9149e3e Delete Selenium tests in Ruby
They are replaced by Selenuium tests in Node.js.

Bug: T162455
Change-Id: I1f5bc8f9c5cd687a6ba116f2f0461eb2992096c7
Depends-On: Ibd8a39cc75231932f872456b8d3ec1fe41ef23e2
2018-05-25 05:58:17 +00:00
jenkins-bot 5581b9779a Merge "Selenium tests for Math" 2018-05-24 16:14:52 +00:00
Moritz Schubotz (physikerwelt) b5cf0e0b77
Serve png mode from mathoid
* Use the exactly same routines to deliver png images that are used in
  mathml mode.
* Change the output to use mathoids png image rather than the mathml
  and svg output.
* Locally tested on Firefox and Chrome: Depending on the mode either
  the SVG or the PNG path is used.

Bug: T74240
Change-Id: I4b1cac92eb9a02190f316faab6621940951603d5
2018-05-21 13:47:49 +02:00
Željko Filipin befe4af465 Selenium tests for Math
* Implement a basic tests that renders $2+3$

Bug: T162455
Change-Id: Ic605bd0d934d0f138390145fa5f5bddaa8f8e578
2018-05-19 17:04:22 +00:00
Thiemo Kreuz b12b4f740f Throw InvalidArgumentException when validating/formatting null
Change-Id: Ia46f76a89b26c830aab70ebf5fcc222711c325d1
2018-05-18 20:02:43 +02:00
Kunal Mehta 7a53bd905c Disable PHPCS more narrowly
Change-Id: I20d8b519d5827e865ccd3adf7c2c6ba069f37afb
2018-05-03 19:00:55 -07:00
Moritz Schubotz (physikerwelt) 88546ae1ad
Move phpunit test files
* currently the phpunit tests are not triggered by jenkins
* some test can't be re-enabled possible reasons:
** the texvc and texvccheck binaries are not available from jenkins
** the binaries can not be generated
** the path to the binaries are not set up correctly

Bug: T142120
Change-Id: I0c8fe5ad652c4663eeb029781521acbf56e42bad
2018-04-22 10:09:12 +02:00
Jayprakash12345 270b942c64 Update extensions to take advantage of parser test autodiscovery
Bug: T170037
Change-Id: I2fe982bc146355d7faec03e39a2a59e9d32e22be
2018-04-13 17:37:23 +00:00
jenkins-bot 0a8608399a Merge "Fix MathFormatter failing on new SnakFormatter format MIME types" 2018-04-13 16:11:03 +00:00
Thiemo Kreuz 1f87afa8e6 Fix MathFormatter failing on new SnakFormatter format MIME types
A formatter like this is not supposed to check if the format is known
or not. The code calling these formatters can introduce new (sub) formats
any time. What a formatter like this should do then are two things:
* If it's some HTML format, always return HTML.
* If you really can't identify the format, do a sensible fallback.

This currently blocks introducing a new format in Wikibase.

Bug: T46727
Change-Id: I585069e8f2ba33ec657ca4d514c6d502fe0f5ba3
2018-04-13 14:46:58 +00:00
jenkins-bot 3291177420 Merge "Use "@license GPL-2.0-or-later" according to SPDX" 2018-04-13 14:21:44 +00:00
jenkins-bot 04e17f7e1e Merge "Remove non-helpful comments" 2018-04-13 14:09:33 +00:00
Thiemo Kreuz 945ef79559 Use "@license GPL-2.0-or-later" according to SPDX
Change-Id: I5b9ba062f51dce9fcc10f7c31f37c137176bfff3
2018-04-13 16:07:10 +02:00
Thiemo Kreuz 920ca42c59 Remove insonsistent "@ingroup Extensions" tag
This is obviously copy-pasted from somwhere else. Note that this tag
only appears in these two files. No other file does have it. It's not
useful for anything this way.

Change-Id: I7e0dcf0594fb59b396b1fd26b13383d59227b3f9
2018-04-13 15:33:41 +02:00
Thiemo Kreuz 3f0398e031 Remove non-helpful comments
Documenting protected members as protected members is not really helpful.
One can see this by looking at the code.

Same for documenting a variable named "$html…" as "HTML". This does not
add anything.

Change-Id: I72364b6857166d77b9c85aa884cd139dc163c6bb
2018-04-13 15:32:05 +02:00
libraryupgrader 5a076f94aa build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment

Change-Id: Ia8000677263c4150d4900526bcba1c0602664b8e
2018-03-29 03:44:44 +00:00
Umherirrender 43b187e6fd Move @covers closer to test class
Change-Id: I25987f180c134b53f7ade3e2a2225328f5b088a8
2018-03-10 12:20:29 +00:00
Moritz Schubotz d8822169ab
Mathoid CLI interface
Renders formulae via mathoid without to run mathoid as a service.
Mathoid 0.7.1 or later must be installed locally and configured to be
accessed directly from the math extension. It has been tested with the
config.dev.yaml of version 0.7.1. If mathoid is installed in
'/srv/mathoid' the following line might be added to LocalSettings.php
$wgMathoidCli = ['/srv/mathoid/cli.js', '-c', '/srv/mathoid/config.dev.yaml'];
i.e., make sure to specify the -c parameter with an absolute path.
In addition mathoid uses more memory than the the default. With
the config.dev.yaml a value of
$wgMaxShellMemory = 2097152;
has been tested to work well.

Change-Id: I0600f056d21927963267cf979d342e313419e9fa
2018-02-21 20:29:20 +01:00
Moritz Schubotz (physikerwelt) 26e9f00c2a
Fix broken links in phpunit covers annotations
Phpunit now checks if the coverage annotations are reasonable.

This fix corrects unresolvable references in phpunit covers annotations.

Change-Id: I7eba10bd7dc445b175df750465bb80bd5ef0f4c6
2018-02-05 16:24:46 +01:00
Umherirrender 13d43ec6be Rename files to match classes
Change-Id: Iecf3ea2d0e7ec3dc0f743a3d1a8d85463939d19d
2017-12-10 12:42:41 +01:00
libraryupgrader bc0b7ee838 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
The following sniffs are failing and were disabled:
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.ClassMatchesFilename.WrongCase
* MediaWiki.Files.OneClassPerFile.MultipleFound

Change-Id: Ia2c06ebe33acefdf03625d86d98bf0dbaf826c4c
2017-09-01 04:53:09 +00:00
Kunal Mehta df1689c717 build: Updating mediawiki/mediawiki-codesniffer to 0.11.0
Change-Id: I8ce8155621fbfc5cb3dcf5dafbfa89796d0c1f11
2017-08-10 23:57:43 -04:00
Umherirrender 2bbb86b868 Improve some parameter docs
Change-Id: If7d52d77935b7dd6cddd583b9a6215735fa8b91e
2017-08-09 22:56:19 +02:00
Thiemo Mättig bdeec56d1f Fix and add missing documentation and fix minor code smell issues
Change-Id: Ifa2f8a47fbd0bdd20334f59dd06a21339b9a4292
2017-07-10 11:40:12 +02:00
Kunal Mehta fbd17b4fef build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.DuplicateReturn
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I46c900a5652a6560d18be6cd67badc37ed7f8d97
2017-06-21 00:59:25 +00:00
Moritz Schubotz f5fdda0ba1 Improve error reporting
Display error message in the UI,
if the check command passes,
but the mml/svg/complete endpoints returns an valid json error.

Bug: T143225
Change-Id: I50776926e42f75a2c1e30fc9afe08baae3fcdbd1
2016-08-17 21:15:02 +02:00
Željko Filipin 61abb07b5d Fix Watir::Wait::TimeoutError in Selenium tests
Bug: T137711
Change-Id: I9aeb9d4c38bff31bdc2f248b74b6797a4e518f3d
2016-06-13 17:03:40 +02:00
Željko Filipin c4636667d4 Fix Cucumber scenario that is broken in daily Jenkins jobs
"Welcome to Wikipedia" popup broke the scenario.

Bug: T94150
Change-Id: I5d3b41b8f3060f6edc41a5afe2c992fc6faca4e7
2016-05-16 18:11:59 +02:00
Željko Filipin d2ff0ef699 Fixed broken Selenium test
The test is broken on beta cluster because the formula is rendered as
meta tag. It is rendered at img tag on my mediawiki-vagrant virtual
machine. The test now works on both environments.

Bug: T128190
Change-Id: I458d618af24533d104fcac25a8d8c6468b14605a
2016-04-26 19:07:49 +02:00
jenkins-bot 462178f320 Merge "Migration of browsertests* Jenkins jobs to selenium* jobs" 2016-04-25 17:05:39 +00:00
Željko Filipin 7bc7a0cabf Migration of browsertests* Jenkins jobs to selenium* jobs
selenium* jobs are a new way of running Ruby based Selenium tests. The
jobs are triggered daily.

Bug: T128190
Change-Id: Ide349ea15e0c38ff9f61d348abd61cd2349a83f6
2016-04-25 18:31:00 +02:00
physikerwelt 6b984122a1 Ensure use of ; to seperate svg styles
It was reported that under certain circumstances a semicolon was
missing from the SVG style.

Bug: T132563
Change-Id: I148433657848fdc74889fcaf6d883078c46a4006
2016-04-21 08:55:21 +00:00
physikerwelt 6f7bcaf2c6 Update to mediawiki-codesniffer 0.6.0
Change-Id: I2a1a74c771bc00f6c1569568dfcf474f06714426
2016-04-19 17:07:21 -04:00
physikerwelt 6699724d65 Convert all array() syntax to []
Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Change-Id: I1d2604e3f246ede58ff8245ba2b940f258d2d80c
2016-04-13 10:18:23 -04:00
physikerwelt 31cd0d611a Insert MathML content after tidy
* BeforeTidy caused problems when math tags were used
  within links.

Bug: T130508
Change-Id: Icb9b88a7552d14231f96cbfd2b3cf3fa7e29276d
2016-03-24 13:31:15 +00:00
daniel 7018e85b7d Show TeX in wikibase diffs.
Diffs should show the rendered output as well as the TeX source,
so changes that do not affect the output noticably can still be
assessed by looking at the diff.

Bug: T125712
Change-Id: I098d30ea3158ec34723bfca313cf2bcc4cbc591f
2016-02-25 12:59:12 +01:00
Željko Filipin a4948c208a Fixed failing Selenium test
When user is logged in, visual editor is the default editor. When user
is not logged in, source editor is the default editor. When the test
does not log in, everything works just fine.

Bug: T126463
Change-Id: I1f15000a275657c0a92172781f57c5d1db537dcc
2016-02-22 09:51:24 +00:00
physikerwelt 9e605e09cd Render all math tags in parallel
Bug: T125543
Change-Id: Ia2febf2c0309e5de514445ad2aad58b7e5ce6837
2016-02-18 02:25:38 +00:00
Željko Filipin 11825b9c17 Fixed broken Selenium test
The problems was that visual editor is the default editor at
en.wikipedia.beta.wmflabs.org, and the test was expecting source editor.

The test now works also locally, using mediawiki-vagrant.

Removed headers from some files. We no longer use those headers.

Removed cucumber tags we no longer use, mostly internet explorer.

Added missing dependency (rake) to gemfile.

Bug: T126463
Change-Id: Ia5809f40719a2fe0c6c94338072a38765fa5c87b
2016-02-15 12:50:48 +00:00
physikerwelt 5f16307582 RDF Formatter for Math data type
Bug: T126349
Change-Id: I15fbeec282868b4267a3e3d15740f2c3ff37ea48
2016-02-12 20:38:27 +00:00
Thiemo Mättig 129f0e4bcc Add more complete PHPDoc tags to all tests
... and remove some actual copy-paste mistakes.

Change-Id: Id2fd83edff774a7f07b0f5436cefe2bf5c0a63f0
2016-02-12 17:57:37 +01:00
physikerwelt 47f530b355 Support for chemical formulae
* Add support for LaTeX package mhchem.
* Add hook <ce>
* Add format <math chem>

See bug description for the details.

Bug: T98306
Change-Id: I2ab80834edc5d071618bc52f133cfb2b7ece5016
2016-02-07 18:55:58 +00:00
Thiemo Mättig 8b8d91a771 Clean up Wikibase related code
This fixes some warnings in my PHPStorm, gets rid
of duplicate code, inlines constants that do not
make the code easier to read, and more.

Change-Id: I02f446491509043f5d3e51e26e932f76c9ecb6cf
2016-01-25 16:22:07 +00:00
lyrianos93 946a18d14c Implement datatype 'Math' for Wikidata
This change implements all components to use the datatype 'Math' in Wikidata.
Because 'String 'is used as value type, only the Formatter and Validator are needed to be implemended.

The components are:
* hooks
* Formatter class
* Validator class
* Test cases

Bug: T67397
Change-Id: Ic64fd6c8560f48052e2db24ae1f013d48a82b5e9
2016-01-11 22:29:29 +00:00
Željko Filipin 30fd1cb9b3 Update mediawiki_selenium Ruby gem to the latest version
Bug: T114241
Change-Id: I81a6727fba46a0c9a628c0718e6159cfc8846c22
2015-12-17 12:58:34 +01:00
jenkins-bot dd06d7ed94 Merge "browser test: fix logic to find edit action" 2015-12-15 09:22:44 +00:00
Marko Obrovac c3ebc54994 Minor: rename checkTex() to checkTeX()
Change-Id: I9b1860562b2f4f2112b68c0c3d6f0390f0405fbe
2015-12-14 23:58:08 +01:00
Antoine Musso 0cebe64840 browser test: fix logic to find edit action
The simple math test failed to find the edit link on a non existent
page. It was looking for the text 'Create source' from Vector which is
now simply 'Create'.

Change the PageObject selector to use a CSS selector, more robust to
text changes.

Change-Id: Ifcbd07da8e343b5697fcff6af6ffac90ff4d6420
2015-12-14 21:24:13 +01:00
physikerwelt 897afa480b Use RestBase to check input tex rather than texvccheck
* This will increase the performance of tex rendering for all
 rendering modes since no shell access is required anymore.

 Merge with caution. If the connection to restbase fails, rendering
 of new formulae will be completely disabled i.e. broken.

Change-Id: I1982612e8c6a356e3dbdf447724ac82e5968cc77
2015-12-03 09:03:43 +00:00
physikerwelt f63eaeac23 Restbase based texvc input check
This change only connects the restbase and the mathinput interfaces
but does not change any functionality.

Change-Id: I3a23e5008c26c5f14ad842dcb5d22906a8aff33c
2015-12-03 08:56:47 +00:00
physikerwelt c66a85f143 Fix error in checking logic
Tex validation should be skipped if checking is disabled.
Consequently if 'disable tex filter' is set to 'never' it's a double
negation and tex should always be checked.
If 'disable tex filter' is set to always, never check tex.

Change-Id: Ic6fda8016838eae03a0ed36e3d8d4f35423ba8b1
2015-12-03 08:30:24 +01:00
physikerwelt 6ef2e56439 Add Restbase interface
* Add a simple interface to Restbase that currently
  does not do anything.

Change-Id: I4c2ef329b3954fd35276a5e270d0dc3fcacabf7b
2015-12-01 21:10:09 +00:00
paladox df8ad1c799 Add php code sniffer to composer
Add support for php code sniffer

Change-Id: I7dcdd88be4f1f8219f71ab770979284761e09bae
2015-09-23 10:46:14 +01:00
Željko Filipin 646fc8e94b Fixed Style/StringLiterals RuboCop offense
Bug: T111184
Change-Id: Ia51f271b5e06d7bbd9896634b832003d57c30900
2015-09-22 10:18:13 -07:00
Željko Filipin 2bda4398f4 Fixed Style/SpaceInsideHashLiteralBraces RuboCop offense
Bug: T111184
Change-Id: I77573a78136dc9a8fd6f8b7364e23c8bf6db5e7f
2015-09-22 10:18:13 -07:00
Željko Filipin 4e4baedb2b Fixed Style/SpaceAroundOperators RuboCop offense
Bug: T111184
Change-Id: I442e5be94459d5a8bb497edad9fca900c4066ba1
2015-09-22 10:18:13 -07:00
Željko Filipin f85439cce9 Upgrade browser tests to use mediawiki_selenium 1.x
Bug: T99656
Change-Id: Ie170d38082d7441df8014ae97f1be820e21871fd
2015-09-22 10:18:13 -07:00
physikerwelt bc52c77d24 Use extension.json, empty PHP entry point
* Use string constants instead of integers
* Derive new names from old via conversion of constant
  naming convention to CamelCase.
* Replace old constant string e.g. 'MW_MATH_ABC_DEF'
  with new string 'abcDef'
* Replace old constant value with new string.
* Tests to demonstrates what is actually done.
* Rename constants

Bug: T106630
Bug: T106631
Bug: T87941
Change-Id: I6d1094ece79e912d9ddbef6681a25196c7a6e801
2015-07-30 22:01:20 +00:00
physikerwelt 5c12ed983f Remove useless debug functionality
* MathDebug was intended to provide advanced debugging functionality
  for the math extension. However, the interesting debugging and
  logging feature never made it from the debug branch to the master.
* The current debug functionality is mostly useless. Only some values
  are written to memory and never used thereafter.
* This change moves the existing functionality to the MathSearch
  extension and introduced the required hook for that.

Details:
* $wgMathDebug is removed
* A new Hook MathRenderingResultRetrieved is created
* The math rendering object is printed to the svg error
  page if wgDebugComments is active (instead of wgMathDebug)

Change-Id: I6fad69b5d9b9ca8a7d12c7e410d3ae6180fbddbf
2015-07-14 10:34:37 -04:00
physikerwelt (Moritz Schubotz) 6889086753 Move integration tests to a new special page
The integration tests depend on the presence of external servers
and the user settings.
First, people are bothered by  failing test due to problems with
those servers and second, administrators need to run phpunit tests
to verify the configuration settings.
Therefore, we move the integration tests to a special page.

Bug: T87389
Change-Id: If66f13fe7fa16868cd4b1d8f0e0a6e3d49448b27
2015-03-30 11:47:31 -04:00
Bryan Davis 81dbee82c9 Fix PHPUnit provider name
MathCoverageTest::testProvider -> MathCoverageTest::provideCoverage

'test*' reserved for PHPUnit tests and have to make assertions.

Change-Id: If46684eb27a2282b4cd6261bd0a19dba9bc20e27
2015-03-18 17:16:27 +00:00
Kunal Mehta 5a50bb312c Remove U+FEFF before opening <?php tag
Change-Id: Ib2f1a75f4a3b5879809243cf43124bf3ebf83127
2015-03-12 11:50:11 -07:00
jagori 197bd9ccd6 Refactor code for RSpec3 expect syntax incorporation
Bug: T68369
Change-Id: I25e27d8b363957c4217eaf8516d3c9e61ece156e
2015-02-08 18:52:38 +00:00
Timo Tijhof 83da0338ec Minor clean up, optimisations and documentation corrections
* Handle-error-first approach for consistent function body
  termination at the root with the main intend, and less indention.

* __DIR__ instead of dirname( __FILE__ )

* Single quotes.

* Correct pickHost documentation: wgMathMathMLUrl is not an array,
  and is not used in this method, that's at a different level
  of abstraction (via the constructor).

* White spacing.

* require_once is not a function.

Change-Id: Id4bec8415893245e2569a39ab5406a0820238ae4
2015-01-22 10:56:16 -08:00
physikerwelt (Moritz Schubotz) 056e85afe6 Update LaTeXML test
* The LaTeXML server was updated. In the new version unneccary id's
  have been removed.

Change-Id: I25927912f1500ebfe6d61505c0e06ae2c24d6f6a
2015-01-15 11:13:40 +01:00
physikerwelt (Moritz Schubotz) fd8eb448a3 Update MathParser tests
In the most recent version of ubuntu14 the outputhash of the
png images for some math objects has changed.
However, the rendered images seem to look ok.

Bug: T86309
Change-Id: I52dbdefdcfa19c10f1d9d1a43369aabe8bfd92bf
2015-01-10 14:54:03 +00:00
Ori Livneh d9b9b06032 MWException -> Exception
Change-Id: I18da1baeb70387b96e30811a049185a264dec26d
2015-01-09 17:55:54 -08:00
physikerwelt (Moritz Schubotz) 7c5ce98bfa Fix Mathoid integration test
A recent change in mathoid, i.e. 
I8d3cec0ee8a8c9368b7dca89e1d5e0c5683f946c 
removed the margins. This causes breaking unit tests.

Change-Id: I312d6226c6f24c84254b99ee6292564a421133c3
2014-11-24 19:16:04 +00:00
Željko Filipin ce58cbc738 Prepare repository for running RuboCop after every push to Gerrit
For now ignoring all problems.

Bug: 69245
Change-Id: Id1164187eddc6dcb006ca771d62ca867677213f9
2014-10-21 15:04:22 +02:00
Reedy 672df7dcc8 Fix file permissions
Bug: 71941
Change-Id: I7b0eddc0ca679cf233ef29dcdfeca024ecc71d38
2014-10-15 12:16:20 +00:00
Frédéric Wang 3d0b787cbe Move vertical-align back to ext.math.css
This improves If8ee1cf6453257a0a2f6aa186d4007954a8e5d8e

Change-Id: I794b39a5d322a92d9f722ded790e213803448127
2014-10-12 18:22:06 +00:00
C. Scott Ananian 7914fbea61 MathCoverageTest: encode test file using JSON instead of PHP serialize.
This ensures that changes to the test inputs or outputs yield readable
diffs when reviewing.

Change-Id: I7b4ef8102ad7fbf7c289a27db60f304a140b93a5
2014-10-12 18:02:50 +00:00