aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/utils/ZipDirectoryReaderTest.php
Commit message (Collapse)AuthorAgeFilesLines
* MimeAnalyzer: move ZipDirectoryReader to librarydaniel2025-01-031-81/+0
| | | | | | | | | | | | | | | | | Why: - MimeAnalyzer needs ZipDirectoryReader, but it was not part of libs. This was a problem because libs code must note depend on MediaWiki code. Since there seem to be no other users of ZipDirectoryReader, the simplest solution seems to be to move ZipDirectoryReader into the Wikimedia\Mime library. What: - Moved ZipDirectoryReader and ZipDirectoryReaderError into the Wikimedia\Mime namespace under includes/libs/mime. Bug: T382910 Bug: T364652 Change-Id: Iccdade8dcd3211b7e2df2e50694da8d97c82b59e
* tests: Use const for some static data in test filesUmherirrender2024-09-011-9/+3
| | | | Change-Id: Id7ccd48e3bf626095e2d3929831b5d87ed0be948
* utils: Add missing documentation to class propertiesUmherirrender2024-09-011-0/+2
| | | | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Improve a mixed type to string Change-Id: Id994553eaeac181775ac782423ff53928ad45466
* tests: Fix @covers and @coversDefaultClass to have leading \Reedy2024-02-161-1/+1
| | | | Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
* build: Updating mediawiki/mediawiki-codesniffer to 41.0.0libraryupgrader2023-03-111-2/+2
| | | | | | | The following sniffs are failing and were disabled: * MediaWiki.Usage.ForbiddenFunctions.eval Change-Id: I6fd0a9296c88a77c3abec6e5e8d568bb469c2d6e
* Add convenience methods for asserting status.daniel2022-03-161-2/+2
| | | | | | | This ensures that assertions work in a uniform way, and provides meaningful messages in cause of failure. Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
* build: Updating dependencieslibraryupgrader2021-07-221-1/+1
| | | | | | | | | | | | | | composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
* tests: Add explicit return type void to setUp() and tearDown()Max Semenik2019-10-301-1/+1
| | | | | | Bug: T192167 Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43 Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
* Add public as visibility in tests folderUmherirrender2019-10-101-3/+3
| | | | | | | Add public, protected or private to function missing a visibility Enable the tests folder for the phpcs sniff Change-Id: Ibefce76ea9984c47e08c94889ea2eafca7565e2c
* phpunit: Repair GLOBALS reset in MediaWikiUnitTestCaseTimo Tijhof2019-09-021-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code didn't work because the $GLOBALS array is exposed by reference. Once this reference was broken by unset(), the rest just manipulated a local array that happens to be called "GLOBALS". It must not be unset or re-assigned. It can only be changed in-place. Before this, the execution of a MediaWikiUnitTestCase test stored a copy of GLOBALS in unitGlobals, then lost the GLOBALS pointer and created a new variable called "GLOBALS". As such, the tearDown() function didn't do what it meant to do, either – which then results in odd failures like T230023 Rewrite it as follows: * In setup, store the current GLOBALS keys and values, then reduce GLOBALS to only the whitelisted keys and values. * In teardown, restore the original state. * As optimisation, do this from setUpBeforeClass as well, so that there are relatively few globals to reset between tests. (Thanks @Simetrical!) The following tests were previously passing by accident under MediaWikiUnitTestCase but actually did depend on global config. * MainSlotRoleHandlerTest (…, ContentHandler, $wgContentHandlers) * SlotRecordTest (…, ContentHandler, $wgContentHandlers) * WikiReferenceTest (wfParseUrl, $wgUrlProtocols) * DifferenceEngineSlotDiffRendererTest (DifferenceEngine, wfDebug, …) * SlotDiffRendererTest (…, ContentHandler, $wgContentHandlers) * FileBackendDBRepoWrapperTest (wfWikiID, "Backend domain ID not provided") * JpegMetadataExtractorTest (…, wfDebug, …, LoggerFactory, …) * ParserFactoryTest (…, wfDebug, …, LoggerFactory, InvalidArgumentException) * MediaWikiPageNameNormalizerTest (…, wfDebug, …, LoggerFactory, …) * SiteExporterTest (SiteImporter, wfLogWarning, …) * SiteImporterTest (Site::newForType, $wgSiteTypes) * ZipDirectoryReaderTest (…, wfDebug, …, LoggerFactory, …) Bug: T230023 Change-Id: Ic22075bb5e81b7c2c4c1b8647547aa55306a10a7
* Load GlobalFunctions.php to tests/phpunit/bootstrap.phpAmir Sarabadani2019-07-141-88/+0
| | | | | | | That mostly enables testing global functions Bug: T87781 Change-Id: Ib42c56a67926ebcdba53f4c6c54a5bff98cb77a3
* Revert "Separate MediaWiki unit and integration tests"Legoktm2019-06-131-0/+88
| | | | | | | | This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9. Reason for revert: Broke postgres tests. Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
* Separate MediaWiki unit and integration testsMáté Szabó2019-06-131-88/+0
| | | | | | | | | | | | | | | | | | | | | This changeset implements T89432 and related tickets and is based on exploration done at the Prague Hackathon. The goal is to identify tests in MediaWiki core that can be run without having to install & configure MediaWiki and its dependencies, and provide a way to execute these tests via the standard phpunit entry point, allowing for faster development and integration with existing tooling like IDEs. The initial set of tests that met these criteria were identified using the work Amir did in I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory under phpunit/ and organized into a separate test suite. The environment for this suite is set up via a PHPUnit bootstrap file without a custom entry point. You can execute these tests by running: $ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml Bug: T89432 Bug: T87781 Bug: T84948 Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
* Better detection for old MS Office filesTim Starling2019-01-231-1/+2
| | | | | | | | | | | | * Introduce MSCompoundFileReader, which reads the CFB directory and detects the file type from well-known names in the root directory * Do not detect a ZIP file if the EOCDR is not at the end. Other containers, especially CFB files, may contain ZIP files embedded within them in the last 64KB, but this is not a security concern unless the EOCDR is exactly at the end of the file. Bug: T40432 Change-Id: Id5b1a258ccf3c3c8951e32f6b7a5b1bafe941082
* build: Updating mediawiki/mediawiki-codesniffer to 16.0.0Umherirrender2018-02-171-1/+1
| | | | Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
* Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCaseKunal Mehta2018-01-011-0/+3
| | | | Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
* Convert all array() syntax to []Kunal Mehta2016-02-171-6/+6
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Use PHPUnit_Framework_TestCase in a few utils/ testsChad Horohoe2014-12-291-1/+1
| | | | | | | IPTest, StringUtilsTest and ZipDirectoryReaderTest do not need the extra overhead Change-Id: Ic05afb1a3a094a57383d483f4e50bd1ed9a183e2
* Fixed spacingumherirrender2013-11-211-1/+0
| | | | | | | | - Removed trailing spaces in comments - Removed multiple empty lines - Removed space after object operator Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
* Move files with tests to reflect the codeSiebrand Mazeland2013-11-071-0/+85
Change-Id: I7949457fb1ad056dc3db09b43ecf73bc8a61d5a8