Commit graph

25 commits

Author SHA1 Message Date
Daimona Eaytoy d06bd18532 Replace deprecated MWException
Introduce new classes for checked exceptions, and use SPL exceptions
for the unchecked ones.

Bug: T328220
Change-Id: Ic44463e910911afe6395c38fd2f59b9bfa02a4f0
2023-06-09 13:00:46 +02:00
jenkins-bot a4911d2283 Merge "Introduce MathInternalRestbaseURL setting." 2023-05-31 06:28:39 +00:00
daniel 43dd9c7f63 Introduce MathInternalRestbaseURL setting.
This new MathInternalRestbaseURL setting allows the internal URL of
Mathoid to be configured directly, instead of relying on
VirtualRestConfig.

This patch moves the fallback logic for the internal and external API
URL into an extension registration callback. This way, we can keep the
application logic simple, and we can issue config warnings that will
cause the updater to fail, forcing wiki owners to update their config.

Bug: T334842
Change-Id: I2fbc441955a1fe417f264f31f3729ce0715f7f16
2023-05-30 09:48:03 +00:00
rrana-wmf c601e1d6f2 Add test case for MathRestbaseInterface.php
Add test case for getType() method.

This will improve the code coverage for this method from 0 to 100%.

Add test case for getTex() method.

This will improve the code coverage for this method from 0 to 100%.

Add test case for evaluateRestbaseCheckResponse() method.

This will improve the code coverage for this method from 0 to 100%.
And covers getIdentifiers(), getWarnings(), setErrorMessage(),
methods from 0 to 100%.

Change-Id: I6bdb6919126e5488838d4fba53eb2f74c89ee63d
2023-05-22 09:36:29 +00:00
Umherirrender 7a8d5b9dc4 tests: Make some PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: I73d2903fed7523826b71fc452a846dc4c6e85802
2023-05-21 11:00:48 +02:00
rrana-wmf 5926f42b52 Use MultiHttpClient instead of VirtualRESTService.
This fixes the problems with If208753edfdb301 which was reverted
and adds a new test.

Bug: T335347
Co-Authored-By: <rrana-ctr@wikimedia.org>
Change-Id: I7ddb7b294cbccc4dab42e286fc270f438385bee5
2023-05-20 16:57:46 +00:00
Subramanya Sastry de76f99d3d Revert "Revert "Add getMultiHttpClient function to make HTTP requests to Mathoid.""
This reverts commit a38e56c3fc and
reapplies 38c73d9b7a

Bug: T335347
Change-Id: Ib5f82c022d6ff435a807f8f4128a308f3dacc455
2023-05-16 13:07:32 +00:00
Daniel Kinzler a38e56c3fc Revert "Add getMultiHttpClient function to make HTTP requests to Mathoid."
This reverts commit 38c73d9b7a.

Reason for revert: Breaks math on Beta, shouldn't go live.

Change-Id: I62c63e20c94ddc25c5c291ba42afd28e153b34a6
2023-05-12 10:23:31 +00:00
rrana-wmf 38c73d9b7a Add getMultiHttpClient function to make HTTP requests to Mathoid.
This add new function named "getMultiHttpClient" to the
MathRestbaseInterface.
The function creates a MultiHttpClient object using the HTTP
request factory.

This function will be useful for making HTTP requests to Mathoid.

Add test case for getUrl() method.

Bug: T335347
Change-Id: If208753edfdb3017f722c97cea7653170d05f8a5
2023-05-11 17:58:50 +00:00
daniel 3fa7837cee Add test case for MathRestbaseInterface::batchEvaluate
This test case ensures that responses from RESTbase are processed
correctly.

Change-Id: I5fbd45ac5e61a6294817617a6784846ae815fd6e
2023-05-11 19:58:26 +02:00
daniel 38e649c722 Math: test usage of URL in HttpMultiClient
Change-Id: I063319ad1b12d66d2054846e6c3b27c715ca3d31
Co-Authored-By: <rrana-ctr@wikimedia.org>
2023-05-08 18:19:30 +00: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
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
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
Reedy b0f07ee605 Namespace extension
Change-Id: I7ba90b35e5b6f6e4c296079fc524667ea41c0980
2021-04-08 01:17:14 +01: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 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
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
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
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
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
Renamed from tests/MathRestbaseInterfaceTest.php (Browse further)