-
Notifications
You must be signed in to change notification settings - Fork 0
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 test errors #141
Comments
cd /opt/htdocs/mediawiki/extensions/SemanticMediaWiki
composer dump-autoload
WIKI=demo composer phpunit -- --testsuite semantic-mediawiki-unit |
Deprecated: Optional parameter $subject declared before required parameter $property is implicitly treated as a required parameter in /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/src/EntityLookup.php on line 64 Deprecated: Optional parameter $subject declared before required parameter $property is implicitly treated as a required parameter in /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/EntityLookup.php on line 240 Deprecated: Optional parameter $dataItem declared before required parameter $propTable is implicitly treated as a required parameter in /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/SemanticDataLookup.php on line 129 Deprecated: Optional parameter $dataItem declared before required parameter $propertyTableDef is implicitly treated as a required parameter in /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/CachingSemanticDataLookup.php on line 209 Deprecated: Optional parameter $title declared before required parameter $text is implicitly treated as a required parameter in /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/src/Query/ResultPrinters/FeedExportPrinter.php on line 417 PHP Deprecated: Optional parameter $repositoryResult declared before required parameter $query is implicitly treated as a required parameter in /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/src/SPARQLStore/QueryEngine/QueryResultFactory.php on line 62 wfGetDBImportant The following warning message from Unit tests flags SemanticExtraSpecialProperties: Deprecated: Use of wfGetDB was deprecated in MediaWiki 1.39. [Called from SESP\AppFactory::getConnection in /opt/htdocs/mediawiki/extensions/SemanticExtraSpecialProperties/src/AppFactory.php at line 75] in /opt/htdocs/mediawiki/includes/debug/MWDebug.php on line 385 A global search finds these occurrences: 13 results - 8 files /opt/htdocs/mediawiki/extensions/AJAXPoll/includes/AJAXPoll.php: /opt/htdocs/mediawiki/extensions/Flow/includes/DbFactory.php: /opt/htdocs/mediawiki/extensions/Maps/tests/Integration/Semantic/AreaDescriptionTest.php: /opt/htdocs/mediawiki/extensions/SemanticExtraSpecialProperties/src/AppFactory.php: /opt/htdocs/mediawiki/extensions/SemanticExtraSpecialProperties/src/PropertyAnnotators/ApprovedDatePropertyAnnotator.php: /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/docs/releasenotes/RELEASE-NOTES-1.9.2.md: /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php: /opt/htdocs/mediawiki/extensions/WikiCategoryTagCloud/includes/WikiCategoryTagCloud.php: This solution is offered by Extension WikiCategoryTagCloud (the last occurence above) /**
* Get a handle for performing database operations.
*
* This is pretty much wfGetDB() in disguise with support for MW 1.39+
* _without_ triggering WMF CI warnings/errors.
*
* @see https://phabricator.wikimedia.org/T273239
*
* @return \Wikimedia\Rdbms\IDatabase|\Wikimedia\Rdbms\IReadableDatabase
*/
public static function getDBHandle() {
$services = MediaWikiServices::getInstance();
if ( method_exists( $services, 'getConnectionProvider' ) ) {
return $services->getConnectionProvider()->getReplicaDatabase();
} else {
return $services->getDBLoadBalancer()->getConnection( DB_REPLICA );
}
} |
Use the tests/README in the SMW repo |
The PHP_CodeSniffer "phpcs" command ran out of memory. Important PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8388616 bytes) in /opt/htdocs/mediawiki/vendor/squizlabs/php_codesniffer/src/Fixer.php on line 129 |
|
Not sure why this is undefined, since the manual says to use/define it after the call to enableSemantics(), and we do. |
CausePHPUnit's units of code are now namespaced, and so 'PHPUnit_Framework_TestCase' should be PHPUnit\Framework\TestCase and even that appears to have changed to TestSuite Why do I get this error?You can receive this error after PHPUnit 6+ released on 2017-02-03 when tests use old code.
What needs to be fixed?
|
PHPUnit\TextUI\RuntimeException: Class "PHPUnit_Framework_TestCase" not found in /opt/htdocs/mediawiki/vendor/phpunit/phpunit/src/TextUI/Command.php:101 |
but Paladox just addressed this issue in MW core and it is unclear how to convert to just 'phpunit' instead of 'tests/phpunit/phpunit.php' without breaking backwards compatibility? |
The phpunit.xml.dist configuration needs to be updated
|
Replace deprecated Class loading for \PHPUnit\Framework\TestCase Fixes Issue #141
This is ugly
|
WIKI=demo ./vendor/bin/phpunit --list-groups Available test group(s):Available test group(s):
|
Group semantic-mediawiki
Two groups
Just Group SMW - 390 tests
|
|
There were 19 errors:
/opt/htdocs/mediawiki/includes/parser/Parser.php:6413
/opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/PHPUnitCompat.php:42
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249
/opt/htdocs/mediawiki/extensions/TemplateStyles/includes/Hooks.php:249 There were 120 warnings:
There were 11 failures:
/opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/MediaWiki/Specials/Browse/HtmlBuilderTest.php:267
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 1. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 1. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== ]
Failed asserting that 0 matches expected 1. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82
==== (actual) ==== ==== (StringContains expected) ==== Failed asserting that 0 matches expected 2. /opt/htdocs/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:82 |
On a "clean" (not using my Meza instance) SMW checkout on my workstation, using Gesinn IT Docker CI, I get the following results from
|
In a wiki docker container for just the JSONScriptTestCaseRunnerTest class: FAILURES! |
::testCaseFile .*0001.jsonFor this specific PHPUnit run, we include just 4 tests and stepped through exceptions with the XDebug debugger.
The attached 'debug.log' is some text notes with stack traces. Note: Say you want to change code and execute test #8 in that JSON file. You can execute the same test manually through the api.php with e.g.
|
make ci on SMW 5.x w/ MW 1.43Master ('Before')Paladox Patch 7 ('After')Here are the results 2025-02-17 from
BeforeTests: 6994, Assertions: 12471, Warnings: 121, Skipped: 26. AfterTests: 6888, Assertions: 12331, Warnings: 115, Skipped: 29 and
Slow test(s) count: 3
BeforeTests: 1798, Assertions: 9111, Failures: 13, Skipped: 40, Risky: 3. AfterTests: 1798, Assertions: 9111, Failures: 13, Skipped: 40, Risky: 3. Specific Failures
|
composer test
results in all available memory to be consumed and load to go through the roof so that VSCode disconnects and the terminal becomes unresponsive.I'm not sure that I've resolved that - but I know that I can allocate a specific amount of memory to composer. In the near term I'm focusing on running PHPUnit tests only on SemanticMediaWiki instead of all core and all extensions.
Shows that I'm running PHPUnit 9.6.19
You can actually do this a bit more elegantly with
which reports
The text was updated successfully, but these errors were encountered: